adrianliaw / PyCuber

Rubik's Cube solver in Python
MIT License
195 stars 46 forks source link

Running solver.solve() raises a StopIteration error #10

Closed jbwincek closed 8 years ago

jbwincek commented 8 years ago

The code I ran:

import pycuber as pc
c = pc.Cube()
alg = pc.Formula()
random_alg = alg.random()
from pycuber.solver import CFOPSolver
solver = CFOPSolver(c)
solver.solve()

The error message it produced:

Cross:  Cross ......
Solving F2L#0 ......Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pycuber/solver/cfop/__init__.py", line 26, in solve
    f2l = next(f2lall)
StopIteration

I'm running Python 3.5.0, with the current release of PyCuber

jbwincek commented 8 years ago

That code sample is of course missing c(random_alg), once that was added the issue went away. Sorry for opening a semi-non issue, though it might be worth it to check if the cube is solved before trying to solve it, or at least raising a more intelligible error than just StopIteration