cube_solver.solver.thistlethwaite module
Thistlethwaite solver.
Implementation of the four-phase algorithm proposed by Morwen B. Thistlethwaite.
For more information, see: https://www.jaapsch.net/puzzles/thistle.htm
Examples
>>> from cube_solver import Cube, Thistlethwaite
>>> solver = Thistlethwaite()
>>> cube = Cube("L2 U R D' B2 D2 F B D")
>>> solver.solve(cube)
"D F B U2 B2 L2 U L' D F2 B2 R2 F2 L2 D2 F2 B2 L2 F2"
Solution divided by phases.
>>> solver.solve(cube, verbose=2)
['D F B', 'U2 B2 L2 U L', 'L2 D', 'F2 B2 R2 F2 L2 D2 F2 B2 L2 F2']
- class cube_solver.solver.thistlethwaite.Thistlethwaite(use_transition_tables=True, use_pruning_tables=True)[source]
Bases:
BaseSolverCreate
BaseSolverobject.- Parameters:
use_transition_tables (bool, optional) – Whether to use transition tables for cube state transitions. If
True, creates or loads the tables from thetables/directory. Default isTrue.use_pruning_tables (bool, optional) – Whether to use pruning tables to reduce the tree search space. If
True, creates or loads the tables from thetables/directory. Default isTrue.
See also
solveSolve a cube position.
- num_phases: int = 4
Number of phases of the solving algorithm.
- partial_corner_perm: bool = True
Whether the solving algorithm uses the normal or the partial corner permutation.
- partial_edge_perm: bool = True
Whether the solving algorithm uses the normal or the partial edge permutation.
- static phase_coords(coords, phase)[source]
Get the coordinates for the specified phase.
- Parameters:
coords (tuple of int) – Flatten cube coordinates.
phase (int) – Solver phase (0-indexed).
- Returns:
phase_coords – Phase coordinates.
- Return type:
tuple of int
Notes
Depending on the class attributes
partial_corner_permandpartial_edge_perm, thecoordsparameter is the flattened version of the output from theget_coords()method.