File size: 852 Bytes
2c54126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from core import verify_sigma, SOLUTION_M4
print(f"Len: {len(SOLUTION_M4)}")
ok = verify_sigma(SOLUTION_M4, 4)
print(f"OK: {ok}")
if not ok:
    m = 4
    n = m**3
    for c in range(3):
        vis = set(); cur = (0,0,0)
        for i in range(n):
            if cur in vis:
                print(f"Cycle {c} repeated {cur} at step {i}")
                break
            vis.add(cur)
            p = SOLUTION_M4.get(cur)
            if not p:
                print(f"Cycle {c} missing key {cur}")
                break
            arc_type = p[c]
            next_v = list(cur)
            next_v[arc_type] = (next_v[arc_type] + 1) % m
            cur = tuple(next_v)
        else:
            if cur != (0,0,0):
                print(f"Cycle {c} did not return to origin, ended at {cur}")
            else:
                print(f"Cycle {c} VALID")