Coder Social home page Coder Social logo

cube-solving-basic-algo's Introduction

cube-solving-basic-algo

Project made for Robotics club of NIT-H

Language: C

The basic overview of steps involved in a solution of a rubik's cube

Download the library to be used : Link 1

To link this library to your code use these steps : watch from 1:41 Youtube

Here is the basic layout of the cube

We can see that every step is in form of rotation of one of six faces in either clockwise or anti-clockwise direction relative to the face and we have defined functions for the same

layout of cube

Basic overview of functioning of library

We are imagining the cube as a 6x3x3 matrix which hold values according to the above layout

Using the library functions

First we need to create a 6x3x3 matrix like this :

int cube[6][3][3]= {{{11, 12, 13}, {14, 15, 16}, {17, 18, 19}}, {{21, 22, 23}, {24, 25, 26}, {27, 28, 29}}, {{31, 32, 33}, {34, 35, 36}, {37, 38, 39}}, {{41, 42, 43}, {44, 45, 46}, {47, 48, 49}}, {{51, 52, 53}, {54, 55, 56}, {57, 58, 59}}, {{61, 62, 63}, {64, 65, 66}, {67, 68, 69}}};

We can(should) change the values depending on how we have scrambled the cube

To rotate one face clockwise we use the following statement : face1(&cube[0][0][0], 0) // this rotates the face1 clockwise ie. the white face

List of functions

function name work
face1(int *a, int b) rotates white face
face2(int *a, int b) rotates red face
face3(int *a, int b) rotates green face
face4(int *a, int b) rotates orange face
face5(int *a, int b) rotates blue face
face6(int *a, int b) rotates yellow face

First parameter tells the address first element of the face

Second tells if rotation is clockwise or anti-clockwise

0 for clockwise

1 for anti-clockwise

cube-solving-basic-algo's People

Contributors

bhatakti-atama avatar sn99 avatar

Stargazers

 avatar hypervvik avatar

Watchers

James Cloos avatar  avatar hypervvik avatar

Forkers

sn99 kishorerabha

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.