Git Product home page Git Product logo

python-rubik's People

Contributors

spaceone avatar wiston999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-rubik's Issues

Error when installing module

Hi,
I keep getting an error when installing the module with pip. The message says "No module named 'pip.req'" and the exit code is 1. I don't know what to do to install it.
Thanks

CFOP and Beginner methods take too many moves

Given the input: "oooyybgwbborbbrrbrwryyrywwwooyggyggbgwwboryggbgowwoyrr", I used the CFOP method which took 106 moves to solve.

Here is the Solution:
F2, Y, L, F, U', F', L', U, F2, Y, F, R, U', R', F', U, U, F2, Y, F2, F2, Y, B, U, B', U', R, U, R', U', R, U2, R', Y, U2, B, U, B', U, U, U, U, R, U2, R', U, R, U', R', Y, B, U, B', U, F', U', F, U', F', U', F, Y, U, F', U2, F, U', R, U, R', Y, Y, L', B', L, U', R', U, R, L', B, L, U, Y, Y, Y, Y, U, Y, Y, Y, R2, Y', D', R, U', R, U, R', Y, D, R2, Y, R, U', R'

The Kociemba algorithm for example only took 21 moves and the CFOP is supposed to take around 40 to 60 moves max. I don't really understand the program but I kinda get the concept of CFOP. Could someone explain what's going on? Thanks

CFOP rotates badly

I had 4 y moves in a row, three times, in my last scramble.

Scramble:
'YYYYYWYOYBBBBBBBBBRWRRRRRORGRGGGGGGGOROOOOOYOWYWWWWWGW'

Solution:
[U, F2, Y, F2, F2, Y, R', F', U, F, R, U, U, U, F2, Y, F2, F2, Y, B', U2, B, B', U', B, U, U, Y', R', U', R, U2, R', U', R, U, R', U', R, Y, Y, U2, U', R, U', R', U, R, U, R', Y, U', F', U, F, Y, R, U, R', U', U, F', U2, F, U', R, U, R', Y, Y, Y, R', U2, X, R', U, R, U', Y, R', U', R', U, R', F, Z', U, Y, Y, Y, Y, U, Y, Y, Y, Y, U, Y, Y, Y, Y, U, Y, R2, U, R, U, R', U', R', U', R', U, R']

The offending part has 'U y y y y U y y y y U y y y y U y' == 'U U U U y' == 'y'

Edit: link for easy viewing of solution

Cube string notation

Hello,

I am having difficulty understanding the notation used for the string input. From my interpretation of the documentation, the following code represents the mapping of colors to the faces of a cube:

color_side_mapping = { "red": "R", "white": "U", "orange": "L", "green": "F", "blue": "B", "yellow": "D" }

And this code represents the mapping of the faces to their respective indices in a string:

grid_size = 9
face_indices = dict()
face_indices['U'] = list(range(0, grid_size * 1))
face_indices['L'] = list(range(grid_size * 1 , grid_size * 2))
face_indices['F'] = list(range(grid_size * 2 , grid_size * 3))
face_indices['R'] = list(range(grid_size * 3 , grid_size * 4))
face_indices['B'] = list(range(grid_size * 4 , grid_size * 5))
face_indices['D'] = list(range(grid_size * 5 , grid_size * 6))

Example input: wwwwwwwwwooooooooogggggggggrrrrrrrrrbbbbbbbbbyyyyyyyyy

Any clarification would be greatly appreciated. Thank you.

import utils problem

when i want to import: from rubik_solver import utils

this error happened:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in
from rubik_solver import utils
File "C:\Users---\AppData\Local\Programs\Python\Python310\lib\site-packages\rubik_solver\utils.py", line 4, in
from past.builtins import basestring
File "C:\Users---\AppData\Local\Programs\Python\Python310\lib\site-packages\past\builtins_init_.py", line 43, in
from past.builtins.noniterators import (filter, map, range, reduce, zip)
File "C:\Users---\AppData\Local\Programs\Python\Python310\lib\site-packages\past\builtins\noniterators.py", line 24, in
from past.types import basestring
File "C:\Users---\AppData\Local\Programs\Python\Python310\lib\site-packages\past\types_init_.py", line 25, in
from .oldstr import oldstr
File "C:\Users---\AppData\Local\Programs\Python\Python310\lib\site-packages\past\types\oldstr.py", line 5, in
from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (C:\Users---\AppData\Local\Programs\Python\Python310\lib\collections_init_.py)

Solution without rotations.

The solution that the cfop and beginners method solver outputs include a lot of "Y" rotations. I would like the use this for a solving robot that is unable to do full cube rotations. Is there any way to make the solutions not have rotations like the kociemba solution?

Solved cube should result in 0 moves,

rubik_solver -i yyyyyyyyybbbbbbbbbrrrrrrrrrgggggggggooooooooowwwwwwwww -s Kociemba
Read cube yyyyyyyyybbbbbbbbbrrrrrrrrrgggggggggooooooooowwwwwwwww
Solution R, L, U2, R, L', B2, U2, R2, F2, L2, D2, L2, F2

rubik_solver -i yyyyyyyyybbbbbbbbbrrrrrrrrrgggggggggooooooooowwwwwwwww -s Beginner
Read cube yyyyyyyyybbbbbbbbbrrrrrrrrrgggggggggooooooooowwwwwwwww
Solution F2, F2, Y, F2, F2, Y, F2, F2, Y, F2, F2, Y, Y, Y, Y, Y, U, U, U, U

rubik_solver -i yyyyyyyyybbbbbbbbbrrrrrrrrrgggggggggooooooooowwwwwwwww -s CFOP
Read cube yyyyyyyyybbbbbbbbbrrrrrrrrrgggggggggooooooooowwwwwwwww
Solution F2, F2, Y, F2, F2, Y, F2, F2, Y, F2, F2, Y, Y, Y, Y, Y, Y, Y, Y, Y, U, Y, Y, Y, Y, U, Y, Y, Y, Y, U, Y, Y, Y, Y, U, Y, Y, Y, Y, M2, U, M2, U2, M2, U, M2, U, Y, Y, Y, Y, U, Y, Y, Y, Y, U, Y, Y, Y, Y, U, Y, M2, U, M2, U2, M2, U, M2

why?

Can't solve this cube

B B Di Si D D Si Si Di B B D S S D D S D Z Di Di Bi Li R Di Di L Ri Bi Di Di Z Di Di Bi Li R Di Di L Ri Bi Bi Li R Di Di L Ri Bi Di Di Ri Ri Bi Di U Ri Ri D Ui Bi Bi Di U Ri Ri D Ui Bi Bi Di U Ri Ri D Ui Bi Ri Ri Bi Ri Bi Bi R B Ri B R R Bi Bi Ri Bi R Bi Ri Li Bi L U Bi Ui Li B L B Li Bi L U Bi Ui Li B L Bi Li Bi L U Bi Ui Li B L Bi Bi Ui Bi U R Bi Ri Ui B U Bi U R B Ri Bi Ui Bi Li Bi L B U B Ui Bi R B Ri Bi Ui Bi Bi U B R B Ri Bi D B Di Bi Ri Bi Bi R B D B Di Bi L B Li Bi Di Bi Bi D B L B Li Bi

wwwowwwwwgbgrrrbbbooogggrrrbbyooogggrrrbbbowoyyyyyyygy

This cube is soluble; https://github.com/pglass/cube handles it with no issue, as do online solvers:

>>> import rubik_solver.utils
>>> rubik_solver.utils.solve('www' 'oww' 'www' 'gbg' 'rrr' 'bbb' 'ooo' 'ggg' 'rrr' 'bby' 'ooo' 'ggg' 'rrr' 'bbb' 'owo' 'yyy' 'yyy' 'ygy')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "…/python3.10/site-packages/rubik_solver/utils.py", line 57, in solve
    return solver.solution(*args, **kwargs)
  File "…/python3.10/site-packages/rubik_solver/Solver/Beginner/__init__.py", line 14, in solution
    solution += WhiteFaceSolver.WhiteFaceSolver(cube).solution()
  File "…lib/python3.10/site-packages/rubik_solver/Solver/Beginner/WhiteFaceSolver.py", line 75, in solution
    goal_cubie_obj = self.cube.cubies[goal_cubie]
KeyError: None
>>> 
>>> from rubik.cube import Cube; from rubik.solve import Solver; from rubik.optimize import optimize_moves
>>> s = Solver(Cube('www' 'oww' 'www' 'gbg' 'rrr' 'bbb' 'ooo' 'ggg' 'rrr' 'bby' 'ooo' 'ggg' 'rrr' 'bbb' 'owo' 'yyy' 'yyy' 'ygy')); s.solve()
>>> assert s.cube.is_solved()
>>> print(' '.join( optimize_moves(reversed(list(move.rstrip('i') if move.endswith('i') else move + 'i' for move in s.moves))) ))
B B Di Si D D Si Si Di B B D S S D D S D Z Di Di Bi Li R Di Di L Ri Bi Di Di Z Di Di Bi Li R Di Di L Ri Bi Bi Li R Di Di L Ri Bi Di Di Ri Ri Bi Di U Ri Ri D Ui Bi Bi Di U Ri Ri D Ui Bi Bi Di U Ri Ri D Ui Bi Ri Ri Bi Ri Bi Bi R B Ri B R R Bi Bi Ri Bi R Bi Ri Li Bi L U Bi Ui Li B L B Li Bi L U Bi Ui Li B L Bi Li Bi L U Bi Ui Li B L Bi Bi Ui Bi U R Bi Ri Ui B U Bi U R B Ri Bi Ui Bi Li Bi L B U B Ui Bi R B Ri Bi Ui Bi Bi U B R B Ri Bi D B Di Bi Ri Bi Bi R B D B Di Bi L B Li Bi Di Bi Bi D B L B Li Bi
>>> 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.