add move approx

This commit is contained in:
2024-08-24 13:48:36 +03:00
parent 67e8c7a639
commit 50ceb636de
4 changed files with 97 additions and 6 deletions

View File

@ -4,7 +4,6 @@ import copy
from dataclasses import dataclass
from cube import LSECube, condense_algorithm, reverse_algorithm
from eolr import eolrb_solved
from typing import Dict, List, Tuple
@ -13,7 +12,7 @@ class EOLRBSolution:
alg: List[str]
pre_auf: str
post_auf: str
mc: bool
post_ams: str
def lse_brute_force_generator(max_length: int):
@ -80,19 +79,23 @@ def solve_eolrb(cube: LSECube, prune_table: Dict, solve: int):
c.alg(" ".join(moves))
if c.eolrb_hash() in prune_table:
for prune_solution in prune_table[c.eolrb_hash()]:
# TODO: split this function, very ugly copies and very long
prune_cube = copy.deepcopy(c)
prune_cube.alg(" ".join(prune_solution))
alg = condense_algorithm(moves + prune_solution)
# TODO: this is very weird
for _ in range(5):
alg = condense_algorithm(alg)
if len(alg) > 2:
# TODO: check if this is mc
pre_auf = ""
if alg[0].startswith("U"):
pre_auf = alg.pop(0)
post_auf = ""
if alg[-1].startswith("U"):
post_auf = alg.pop(-1)
yield EOLRBSolution(alg, pre_auf, post_auf, False)
post_ams = prune_cube.fix_m_slice()
yield EOLRBSolution(alg, pre_auf, post_auf, post_ams)
# for auf in ["U", "U2", "U'", ""]:
# c = copy.deepcopy(cube)
# auf_alg = f"{' '.join(alg)} {auf}"