Coder Social home page Coder Social logo

simrit1 / min2phasecxx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lilborgo/min2phasecxx

0.0 0.0 0.0 498 KB

Rubik's Cube Solver. An optimized implementation of Kociemba's two-phase algorithm. C++

License: GNU General Public License v3.0

Shell 0.06% C++ 99.32% CMake 0.62%

min2phasecxx's Introduction

min2phase C++

Usage

First, you need to initialize the algorithm using:

    min2phase::init();

After that, you can write the initialization into a file, so the next time the algorithm initialization will be faster. Using:

    min2phase::writeFile("name.m2pc");

Now, the next time you can load the coordinates from the file:

    min2phase::loadFile("name.m2pc");

If you try to load a file that does not exist, min2phase::init() will be executed automatically.

After the initialization, you can execute the solver. This is an example of how it works. See min2phase.h for the arguments explanation of the solver.

#include <iostream>
#include <min2phase/min2phase.h>
#include <min2phase/tools.h>

int main(int argc, char *argv[]){

    min2phase::init();//precomputed coordinates

    std::cout << min2phase::solve(min2phase::tools::randomCube(), 21, 1000000, 0, min2phase::APPEND_LENGTH | min2phase::USE_SEPARATOR, nullptr);
    return 0;
}

See tools.h for some useful function for the solver. You can also read the coordinates from a file, see min2phase.h. Reading from a file the coordinates will increase the speed of the algorithm.

Compiling

cmake CMakeLists.txt
make
g++ -I include/ yourporgram.cpp -L. -lmin2phase -o yourporgram -Wl,-rpath,.

License

This software is distributed on GPLv3.0, more information available in LICENSE.md.

min2phasecxx's People

Contributors

akshat-raj-vansh avatar cs0x7f avatar lilborgo 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.