GithubHelp home page GithubHelp logo

minirubik's Introduction

minirubik

Docker CI

This is a certified solver for the Rubik 2x2

The formalisation is explained in the file paper.pdf,

A position of the cube is encoded by the constructor State that takes 7 cubes (C1, C2, C3, C4, C5, C6, C7) and their respective orientation (O1, O2, O3).

For example, the initial configuration is

State C1 C2 C3 C4 C5 C6 C7 O1 O1 O1 O1 O1 O1 O1

Swapping two adjacent corners gives:

State C2 C1 C3 C4 C5 C6 C7 O1 O1 O1 O1 O1 O1 O1

Swapping two opposite corners gives

State C7 C2 C3 C4 C5 C6 C1 O1 O1 O1 O1 O1 O1 O1

There are 3 positive moves that corresponds to the right face, the back face and the down face. Each move can be applied once (Right, Back, Down), twice (Right2, Back2, Down2) or three times (Rightm1, Backm1, Downm1) and is still considered as a single move.

For example, applying the move Right to the initial configuration gives

State C2 C5 C3 C1 C4 C6 C7 O2 O3 O1 O3 O2 O1 O1

The solve function takes a position and returns a list of minimal length of the moves to return to the initial position.

For example, solving

State C2 C1 C3 C4 C5 C6 C7 O1 O1 O1 O1 O1 O1 O1

returns a list of length 11

Right :: Backm1 :: Down2 :: Rightm1 :: Back :: Rightm1 :: Backm1 :: Right :: Down2 :: Right :: Back :: nil

Other examples are given in the file Example.v

Meta

  • Author(s):
    • Laurent Théry
  • License: MIT License
  • Compatible Coq versions: 8.17 or later
  • Additional dependencies:
  • Coq namespace: minirubik
  • Related publication(s): none

Building and installation instructions

To build and install manually, do:

git clone https://github.com/thery/minirubik.git
cd minirubik
make   # or make -j <number-of-cores-on-your-machine> 
make install

minirubik's People

Contributors

thery avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.