add masking
This commit is contained in:
20
solver.py
20
solver.py
@ -50,19 +50,19 @@ def lse_brute_force_generator(max_length: int):
|
||||
#
|
||||
|
||||
|
||||
def create_prune_table(prune_depth: int):
|
||||
def create_eolrb_prune_table(prune_depth: int):
|
||||
prune_table = defaultdict(list)
|
||||
cube = LSECube()
|
||||
prune_table[hash(cube)] = [[]]
|
||||
prune_table[cube.eolrb_hash()] = [[]]
|
||||
|
||||
generator = lse_brute_force_generator(prune_depth)
|
||||
|
||||
# TODO: for every solved state (pre auf), we can apply the generator's moves and save to prune table?
|
||||
for alg in generator:
|
||||
# TODO: turn the prune table into a dict of list values to store multiple solutions
|
||||
cube.reset()
|
||||
cube.alg(" ".join(alg))
|
||||
setup = reverse_algorithm(alg)
|
||||
prune_table[hash(cube)].append(setup)
|
||||
solution = reverse_algorithm(alg)
|
||||
prune_table[cube.eolrb_hash()].append(solution)
|
||||
|
||||
return prune_table
|
||||
|
||||
@ -79,15 +79,13 @@ def solve_eolrb(cube: LSECube, prune_table: Dict, solve: int):
|
||||
for moves in lse_brute_force_generator(solve):
|
||||
c = copy.deepcopy(cube)
|
||||
c.alg(" ".join(moves))
|
||||
if hash(c) in prune_table:
|
||||
for alg_start in prune_table[hash(c)]:
|
||||
alg = condense_algorithm(alg_start + moves)
|
||||
if c.eolrb_hash() in prune_table:
|
||||
for prune_solution in prune_table[c.eolrb_hash()]:
|
||||
alg = condense_algorithm(moves + prune_solution)
|
||||
# TODO: this is very weird
|
||||
for _ in range(10):
|
||||
alg = condense_algorithm(alg)
|
||||
if len(alg) == 0:
|
||||
yield EOLRBSolution(alg, "", "", False)
|
||||
else:
|
||||
if len(alg) > 2:
|
||||
# TODO: check if this is mc
|
||||
pre_auf = ""
|
||||
if alg[0].startswith("U"):
|
||||
|
||||
Reference in New Issue
Block a user