Neuromind / Kangaroo.pyx
Seriki's picture
Upload 27 files
b0c3c60 verified
import hashlib
import random
import pyttsx3
from datetime import datetime
from queue import Queue
import threading
import string
from time import sleep
import pandas as pd
# CONFIG
CSV_FILE = "bitcoin-puzzle-unsolved-20260220.csv"
NOTEPAD_FILE = "bitcoin_experiment_notepad.txt"
NUM_THREADS = 4
MAX_CANDIDATE_LENGTH = 4
VOICE_ENGINE = pyttsx3.init()
KANGAROO_MAX_STEPS = 1000
# VOICE NOTIFICATION
def notify_creator(message):
print(f"LMLM Notification: {message}")
VOICE_ENGINE.say(f"Hello my creator Seriki Yakub, update: {message}")
VOICE_ENGINE.runAndWait()
# LOAD CSV
df = pd.read_csv(CSV_FILE)
# LOGGING
def log_to_notepad(entry):
with open(NOTEPAD_FILE, "a") as f:
f.write(entry + "\n")
# HASH FUNCTION
def candidate_hash(candidate):
return hashlib.sha256(candidate.encode()).hexdigest()
# KANGAROO STEP FUNCTION
def kangaroo_jump(candidate, step_size=3):
chars = string.ascii_letters + string.digits
candidate_list = list(candidate)
for _ in range(step_size):
idx = random.randint(0, len(candidate_list)-1)
candidate_list[idx] = random.choice(chars)
return ''.join(candidate_list)
# PUZZLE WORKER WITH KANGAROO
def puzzle_worker(task_queue):
while not task_queue.empty():
task_id, target_hash = task_queue.get()
log_to_notepad(f"[{datetime.now().isoformat()}] Starting puzzle {task_id}")
# Initial candidate (could come from previous genetic population or heuristic)
candidate = ''.join(random.choices(string.ascii_letters + string.digits, k=MAX_CANDIDATE_LENGTH))
for step in range(KANGAROO_MAX_STEPS):
chash = candidate_hash(candidate)
success = chash == target_hash
log_to_notepad(f"[{datetime.now().isoformat()}] Puzzle {task_id} Step {step} Candidate: {candidate} Success: {success}")
if success:
log_to_notepad(f"[{datetime.now().isoformat()}] Puzzle {task_id} SOLVED: {candidate}")
notify_creator(f"Puzzle {task_id} solved! Key recorded in notepad.")
break
# Kangaroo jump to next candidate
candidate = kangaroo_jump(candidate, step_size=random.randint(1,5))
sleep(0.05) # small pause to prevent CPU overload
task_queue.task_done()
# MULTI-THREAD QUEUE
task_queue = Queue()
for _, row in df.iterrows():
task_queue.put((row['puzzle_id'], row['hash']))
threads = []
for _ in range(NUM_THREADS):
t = threading.Thread(target=puzzle_worker, args=(task_queue,))
t.start()
threads.append(t)
for t in threads:
t.join()
notify_creator("All puzzle attempts completed! Check your notepad for full logs.")