chrishunt / rubiks-cube

Solve your Rubik's Cube with an easy two-cycle solution
MIT License
128 stars 21 forks source link

add ability to enter cube by colors #5

Closed jkingdon closed 11 years ago

jkingdon commented 11 years ago

Although relative notation (up, front, etc) is obviously best for many purposes, it might not be the easiest way to enter the state of a cube (especially for people new to this stuff). Here's a class which lets you read off the colors of your cube and construct a Cube object from that (then you can get out everything the usual notation).

There's a bit of documentation in a comment at the top of the source, although the ideal documentation would have some drawings showing what order the faces are supposed to be listed.

jkingdon commented 11 years ago

Hmm, seems to largely duplicate #4 but I haven't had time to compare them in detail. Some of the tests for this one might be worth carrying over if nothing else....

chrishunt commented 11 years ago

@jkingdon AWESOME! Thanks for taking the time to do this. :sparkles: Lots of folks wanted this, but sadly we just implemented it very similarly in #4 as you noticed. The syntax is very similar as well, except we scrap the delimiters.

Feel free to open a new issue if you see issues in the current implementation.

Happy cubing.

jkingdon commented 11 years ago

No problem, my fault for taking so long to submit a pull request. I'll try to port over some of the tests if I get some time. The delimiters were intended to make it less error prone (and more readable), but maybe just doing some of the other checks is enough for the error detecting part. Errors (especially typos) seem likely when inputting a state from a physical cube.