pglass / cube

Python Rubik's cube solver
MIT License
155 stars 52 forks source link

Hangs forever if a corner's been twisted #3

Closed James-E-A closed 1 year ago

James-E-A commented 1 year ago

If someone rotated a corner of the cube before giving it to me, perhaps as a prank, this isn't caught by the current codebase; it just hangs indefinitely.

>>> from rubik.cube import Cube
>>> from rubik.solve import Solver
>>> s = Solver(Cube('orwowgwywgbgrgrbobowyggbrrbybrgowoygryrbbgoobyoyrywyww'.upper()))
>>> s.solve()
^C…

For other non-solvable states, such as a flipped edge, the code does catch these.

But when it comes to rotated corners, it just enters an infinite loop.

pglass commented 1 year ago

This is fixed in 0.0.2