GithubHelp home page GithubHelp logo

pyrubiksim's Introduction

pyRubikSim

*Python utils to simulate a Rubik's Cube. The aim of this code is to give a simple rubik cube simulator to test Discrete Planning Techniques. The code was developed for AI teaching purpose.

*Also I have included a code file adapted from David Hogg https://github.com/davidwhogg/MagicCube to allow the 3D visualization of the cube

prof.: Miguel Hernando (2017)

LIB REQUIREMENTS:

Numpy is used for face representation and operation Matplotlib only for drawing.

pip3 install numpy
pip3 install mathplotlib

Universidad Politécnica de Madrid

https://github.com/mhernando/pyRubikSim

 

STATE CONVENTIONS:

Image of rubik

The figure shows the face state order as it is internally represented.

Each face is represented by state matrix (NxN) and each cell is an integuer (0-5). Row and columns are disposed with the origin at the upper left corner, with faces disposed as the unfolded cube states.

Rotations are referred to axis relative faces.

  • The outward-pointing normal of face 1 is the X axis.
  • The outward-pointing normal of face 2 is the Y axis.
  • The outward-pointing normal of face 4 is the Z axis.

Rotations are considered positive if they are ccw around the axis (math positive rotation) The cube slices are considered as layers. The upper layer (faces 1, 2 or 4) have index 0, while de backward layers (3,0,5) have index N-1 (N is the cube dimension)

Initial colors have the same index than their respective faces

###example of use:

import rub_cube as rb
b=rb.RubCube(3)
b.rotate_90('x',0,1)
b.rotate_90('y',1,1)
b.plot()
a=b.get_State()

pyrubiksim's People

Contributors

mhernando avatar

Stargazers

Miguel Granero avatar Andrea Fontalvo Echavez avatar

Watchers

James Cloos avatar  avatar

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.