Giter Site home page Giter Site logo

satinwukerorig / rubiks-lib Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 2.0 36 KB

A Rubik's Cube scrambler written in C++, very sketchy

License: GNU General Public License v3.0

Batchfile 0.46% C++ 97.13% CMake 2.41%
rubiks-cube rubiks-cube-simulator cpp

rubiks-lib's Introduction

Rubiks

A Rubik's Cube representation written in C++

180 turns, center slicing, double layer turns, orientation changes, and move history are not implemented YET.

What is implemented: -cube

Getting Started:

#include<iostream>
#include "cube.h"

unsigned long long perft(Cube cube,int depth){
    if (depth<=0){return 1ULL;}
    unsigned long long nodes=0;
    for (int m=0;m<12;m++){ 
        cube.make_move(m);
        nodes+=perft(cube,depth-1);
        cube.make_move(cube.reverse_moves[m]);   //undo_move  - cheap fix, double the speed over a move_history implementation :D
    }
    return nodes;
}

int main(){
    Cube cube;
    std::cout<<perft(cube,8);
    cube.ascii();
    return 0;
}

Build & Run

Windows

  1. cd src
  2. build or g++ rubiks.cpp -o rubiks.exe -O3

7431ms | 429981696nodes | 57855nodes per ms

MacOS/Linux

make all
./rubiks

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.