3x3x3 Solver in Python

Discussion in 'Software Area' started by Herbert Kociemba, May 3, 2017.

Welcome to the Speedsolving.com. You are currently viewing our boards as a guest which gives you limited access to join discussions and access our other features. By joining our free community of over 30,000 people, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us and we'll help you get started. We look forward to seeing you on the forums!

Already a member? Login to stop seeing this message.
  1. Herbert Kociemba

    Herbert Kociemba Member

    168
    40
    Nov 29, 2008
    I wrote a solver for Rubik's cube in Python. There were several reasons to do so:
    1. First of all I wanted to learn Python.
    2. I do not think there is any other Python solver around which implements the two-phase algorithm in its fully developed form with symmetry reduction and parallel search for different cube orientations.
    3. I quite often get requests from people who build a cube solving robot and which run into problems when they try to use Cube Explorer in their project. It is much easier to integrate some Pyhton modules than to use the quite unflexible interface of Cube Explorer.
    4. The solver runs without any changes on any platform (as far as I know)

    Some discussion about the solver was in the thread "5x5x5-6x6x6-7x7x7-or-nxnxn"-solvers but dwalton76 rightly proposed tho open a new thread for this subject. I am aware that the solver does nothing better than my Cube Explorer program so it might not be of interest for you.

    You can download the project from
    https://github.com/hkociemba/RubiksCube-TwophaseSolver

    Currently (and for the next days) I have the server module "start_server.py" running on my Raspberry Pi3 at home. So if you just run the module "client_gui.py" and fill in the hostname "http://f9f0b2jt6zmzyo6b.myfritz.net" and the port "8080" my raspi should solve your cube without the need of any tables to be generated on your machine.
    If you run "start_server.py" or "example.py" instead some tables are generated which will take about one hour on moderate PC-hardware.
     
  2. Herbert Kociemba

    Herbert Kociemba Member

    168
    40
    Nov 29, 2008
    It was not too difficult to modify/simplify the two phase solver to get an optimal solver for the 2x2x2 cube. It returns all optimal solutions almost immediately. It needs only one 4MB pruning table which is computed in less than a minute.

    You can download the project from
    https://github.com/hkociemba/Rubiks2x2x2-OptimalSolver
     
    4Chan likes this.
  3. dwalton76

    dwalton76 Member

    31
    12
    Jan 2, 2017
  4. dwalton76

    dwalton76 Member

    31
    12
    Jan 2, 2017
    Speaking of python and 2x2x2 solvers, have you ever looked at the winner of this code golf challenge?
    http://codegolf.stackexchange.com/questions/35002/solve-the-rubiks-pocket-cube

    The one that is "edit: half a year later: 427 - 50% = 213.5" has a few bug fixes. It is very difficult to read so I started ungolfing it.
    https://github.com/dwalton76/rubiks...ster/rubikscubennnsolver/RubiksCube222.py#L29

    I need to ungolf it some more, it is still really cryptic.
     
  5. Herbert Kociemba

    Herbert Kociemba Member

    168
    40
    Nov 29, 2008
    I took a look at https://github.com/dwalton76/rubiks...ster/rubikscubennnsolver/RubiksCube222.py#L29 and I must admit that I do not understand the details. But a look at the "lookup-table-2x2x2-solve.txt" shows me that the approach can be much simplified. The table does not need 8!*3^7= 88179840 entries but only 7!*3^6=3674160 entries if you fix for example the DBL corner and do not use any moves D, B and L.
     
    Last edited: May 27, 2017

Share This Page