-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_seeds.py
38 lines (29 loc) · 943 Bytes
/
check_seeds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import subprocess
import threading
START_SEED = 4000
TOTAL = 2000
THREADS = 10
PER_THREAD = TOTAL / THREADS
MAX_SIZE = 2500
STEP = 16
OUT_FILE = "./seeds.txt"
def create_thread(start, end):
process = subprocess.Popen(
[f"./seed_find", str(start), str(end), str(MAX_SIZE), str(STEP)],
stdout=subprocess.PIPE,
)
while True:
line = process.stdout.readline().decode("utf-8")
if not line: break
if line.startswith("FOUND"):
seed_number = line.strip().split(" ")[-1]
print(f"Writing {seed_number}", flush=True)
seed_file = open(OUT_FILE, "a")
seed_file.write(seed_number + "\n")
seed_file.close()
for i in range(THREADS):
start = START_SEED + int(i * PER_THREAD)
end = int(start + PER_THREAD)
threading.Thread(target=create_thread, args=(start, end)).start()
print(f"Started thread {i}")
print("Running...")