Thanks for developing this module, it is truly a great resource. I have used it into my own module and while debugging, I came across a few issues that I would like to inquire about. If you are interested, I would be happy to try using some group theory tools to solve this problem ;)
Here is a simple example to reproduce the issue. Note that the two strings refer to the same Rubik's Cube, but with a different view.
import kociemba as kb
good_state = "UUUUUUUUURRRRLRRRRFFFFBFFFFDDDDDDDDDLLLLRLLLLBBBBFBBBB"
bad_state = "UUUUUUUUUFFFFBFFFFLLLLRLLLLDDDDDDDDDBBBBFBBBBRRRRLRRRR"
print(kb.solve(good_state)) # "R L U2 R L' B2 U2 R2 F2 L2 D2 L2 F2"
kb.solve(bad_state)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/var/folders/kw/8x7phwld2hdcznypdmdjyc6c0000gn/T/ipykernel_75413/4117867588.py in <module>
----> 1 kb.solve(bad_state)
~/opt/anaconda3/lib/python3.9/site-packages/kociemba/__init__.py in solve(cubestring, patternstring, max_depth)
59 """
60
---> 61 return _solve(cubestring, patternstring, max_depth)
62
63 __all__ = ['solve']
~/opt/anaconda3/lib/python3.9/site-packages/kociemba/__init__.py in _solve(cube, pattern, max_depth)
16 return ffi.string(res).strip().decode('utf-8')
17 else:
---> 18 raise ValueError('Error. Probably cubestring is invalid')
19 except ImportError as e:
20 print(e)
ValueError: Error. Probably cubestring is invalid
Expand code of the two cube strings using tools in rubik_cube.py:
import rubik
state = "UUUUUUUUUFFFFBFFFFLLLLRLLLLDDDDDDDDDBBBBFBBBBRRRRLRRRR"
newstate = "UUUUUUUUURRRRLRRRRFFFFBFFFFDDDDDDDDDLLLLRLLLLBBBBFBBBB"
print(rubik.tools.expand_cube(state))
print(rubik.tools.expand_cube(newstate))
---------------------------------------------------------------------------
-----
| U U U |
| U U U |
| U U U |
---------------------------------
| B B B | L L L | F F F | R R R |
| B F B | L R L | F B F | R L R |
| B B B | L L L | F F F | R R R |
---------------------------------
| D D D |
| D D D |
| D D D |
-----
-----
| U U U |
| U U U |
| U U U |
---------------------------------
| L L L | F F F | R R R | B B B |
| L R L | F B F | R L R | B F B |
| L L L | F F F | R R R | B B B |
---------------------------------
| D D D |
| D D D |
| D D D |
-----
Thanks for developing this module, it is truly a great resource. I have used it into my own module and while debugging, I came across a few issues that I would like to inquire about. If you are interested, I would be happy to try using some group theory tools to solve this problem ;)
Here is a simple example to reproduce the issue. Note that the two strings refer to the same Rubik's Cube, but with a different view.
Expand code of the two cube strings using tools in rubik_cube.py: