#!/usr/bin/env python3 import re,urllib.request s=urllib.request.urlopen("https://raw.githubusercontent.com/or18/Rubiks-cube-xcross-solver/main/cli_lite_without_thread.cpp").read().decode() m={line.split('"')[1]:[list(map(int,re.findall(r"\d+",a))) for a in re.findall(r"\{([0-9, ]+)\}",line)] for line in s.splitlines() if line.strip().startswith('{"') and 'State({' in line} alg="R2 U F2 U2 B2 U2 R' U2 F2 R' B2 D2 R U2 D L' R2 D2 F L B' F' U' R L' D R' B R F2 L' F2 L D".split() faces="UDLRFB" f1="DULRBF";f2="UDFBRL" alg=[f2[faces.index(f1[faces.index(x[0])])]+x[1:] for x in alg] alg+="U F U' L F2 U L' F'".split() cp=list(range(8));co=[0]*8;ep=list(range(12));eo=[0]*12 for k,x in enumerate(alg): a,b,c,d=m[x] cp,co,ep,eo=([cp[i] for i in a],[(co[i]+z)%3 for i,z in zip(a,b)],[ep[i] for i in c],[(eo[i]+z)%2 for i,z in zip(c,d)]) if k>=34: slots=[y for y in range(4) if cp[4+y]==4+y and co[4+y]==0 and ep[y]==y and eo[y]==0] cross=all(ep[i]==i and eo[i]==0 for i in range(8,12)) print(k-33,x,"solved slots",[["BL","BR","FR","FL"][y] for y in slots],"cross",cross) print("cp",cp,"co",co,"ep",ep,"eo",eo)