docs: unify algorithm explanation and update teaching video
This commit is contained in:
parent
a1e43bb679
commit
dd5fab9540
15 changed files with 1680 additions and 1050 deletions
|
|
@ -75,8 +75,36 @@ def main():
|
|||
direct = {h for h in range(M)
|
||||
if all(first_output(lower+(h << 35), d) % 10 == 0 for d in terms)}
|
||||
assert analytic == direct and direct
|
||||
assert 2 + (1 << 18)*((8190+4) % M) == 524290
|
||||
assert 4965*4 % M == 3476
|
||||
assert sorted(ts) == list(range(3383, 3440, 5))
|
||||
assert 4965*3383 % M == 2995
|
||||
assert lower == 218767 + (40302 << 18)
|
||||
world = (lower + (2995 << 35) - coordinate_term(51069, 419124)) & MASK48
|
||||
assert world == 15959335054446
|
||||
# Use the film's X-first indexing and check all 25 accepted outputs.
|
||||
terms = [(coordinate_term(51069+i%5, 419124+i//5)-coordinate_term(51069, 419124)) & MASK48
|
||||
for i in range(25)]
|
||||
expected = [1114693760,660285140,2105382940,47575410,1796905160,
|
||||
2074383590,1410817530,1734889590,2009625200,440710690,
|
||||
1664890290,537178720,1699969350,2115254790,688097620,
|
||||
1842255790,1387847170,1302453480,1264531310,344660,
|
||||
1757217670,204531470,2132545510,1606583470,569937090]
|
||||
for i, term in enumerate(terms):
|
||||
output = first_output(lower+(2995 << 35), term)
|
||||
assert output == expected[i] and output % 10 == 0 and output < (1 << 31)-8
|
||||
# Check every row of the selected candidate group and its two constant pieces.
|
||||
root, base = 218767, 40206
|
||||
masks = []
|
||||
for i, term in enumerate(terms[1:], 1):
|
||||
diffs = [(first_output(root+((base+16*j) << 18), term) -
|
||||
first_output(root+((base+16*j) << 18), 0)) % (1 << 31) for j in range(16)]
|
||||
masks.append(sum(1 << j for j, value in enumerate(diffs) if value % 10 in (0, 8)))
|
||||
if i == 1:
|
||||
assert diffs == [1693075028]*8 + [411302484]*8
|
||||
assert [masks[i-1] for i in (1,3,4,8,9)] == [0xff,0xfffc,0xfff8,0xfff0,0xffc0]
|
||||
combined = 65535
|
||||
for mask in masks:
|
||||
combined &= mask
|
||||
assert combined == 0xc0
|
||||
print(f'OK: {len(cases)*M} single-cell identities; '
|
||||
f'25-cell interval intersection equals all {M} high-bit trials ({len(direct)} candidates).')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue