Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kociemba failed for some cases #48

Open
RexWzh opened this issue Feb 19, 2023 · 0 comments
Open

Kociemba failed for some cases #48

RexWzh opened this issue Feb 19, 2023 · 0 comments

Comments

@RexWzh
Copy link

RexWzh commented Feb 19, 2023

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 |
          -----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant