Code Monkey home page Code Monkey logo

twophase-cuber's Introduction

Two-Phase Rubik's Cube Solving Algorithm using Python

Description

Rubik's Cube modelisation in Python using OpenGL for the 3D rendering and animation. This work was inspired by Herbert Kociembia, the method implemented is explained in his Cube Explorer project.

Detailed informations about my own implementation are written in french below.

3D Cube

Setup

Runs on Python 3.7, a config file is provided to create the Conda environment using the following command:

conda env create -f cuber-env.yaml

Alternatively, you can install the dependencies using pip:

python -m pip install requirements.txt

To run the program, performing a single scramble and solve, simply run:

python main.py

Conventions pour la modélisation du Rubik's Cube

Général

Pour un cube résolu on associe les faces à une unique couleur, qui est celle du centre (dont la position ne change jamais), comme décrit ci-dessous :

  • U : Blanc (W)
  • D : Jaune (Y)
  • R : Orange (O)
  • F : Bleu (B)
  • L : Rouge (R)
  • B : Vert (G)

De plus l'ordre d'énumération des faces sera toujours celui décrit ci-dessus.

Chaque mouvement est décrit par la face qui est concernée (U,D,...,B) et par sa force :

  • 0 : Quart de tour dans le sens horaire
  • 1 : Quart de tour dans le sens anti-horaire
  • 2 : Demi-tour

Cela resulte en 18 mouvements différents.

Cube à facettes

Pour chaque face, on associe une liste de facettes [U0,U1,...,U8]

On peut ainsi représenter le patron du cube :

                |----|----|----|
                | U0 | U1 | U2 |
                |----|----|----|
                | U3 | U4 | U5 |
                |----|----|----|
                | U6 | U7 | U8 |
                |----|----|----|
|----|----|----||----|----|----||----|----|----||----|----|----|
| L0 | L1 | L2 || F0 | F1 | F2 || R0 | R1 | R2 || B0 | B1 | B2 |
|----|----|----||----|----|----||----|----|----||----|----|----|
| L3 | L4 | L5 || F3 | F4 | F5 || R3 | R4 | R5 || B3 | B4 | B5 |
|----|----|----||----|----|----||----|----|----||----|----|----|
| L6 | L7 | L8 || F6 | F7 | F8 || R6 | R7 | R8 || B6 | B7 | B8 |
|----|----|----||----|----|----||----|----|----||----|----|----|
                |----|----|----|
                | D0 | D1 | D2 |
                |----|----|----|
                | D3 | D4 | D5 |
                |----|----|----|
                | D6 | D7 | D8 |
                |----|----|----|
                        Blanc.Face[1]
                                |
                                V
                    |----|----|----|
  Blanc.Face[0] =>  | U0 | U1 | U2 |
                    |----|----|----|
                    | U3 | U4 | U5 |
                    |----|----|----|
                    | U6 | U7 | U8 |    <= Blanc.Face[2]
                    |----|----|----|
                      /\
                       |
                Blanc.Face[3]

twophase-cuber's People

Contributors

minipeps avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

simrit1

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.