Giter Club home page Giter Club logo

n-tile-puzzle's Introduction

Algorithms to solve N-tile-puzzle

Implementations of BFS, Greedy-BFS, A*, Iterative Deepening and IDA* for 3 and 4 tile puzzles.

Compiling it

Clone and run make.

Running it

Run ./main passing the algorithm you want to execute. Options are:

  • -bfs for BFS
  • -gbfs for Greedy-BFS
  • -astar for A*
  • -idfs for Iterative Deepening
  • -idastar for IDA*

Also pass a set of initial entries with at least 1 element. Examples are:

  • 0 1 2 3 4 5 6 7 8 (1 element)
  • 1 4 0 5 9 7 2 3 6, 8 7 6 5 4 3 2 1 (2 elements)

Alternatively, you can pass a .txt file with elements separated by a new line. Absolute path must be passed, as shown in the example below:
./main -idastar ~/Desktop/n-tile-puzzle/input/entries.txt

Running it

For input ./main -astar 8 3 5 7 2 6 0 4 1, 3 0 8 7 5 2 1 6 4, 5 4 6 3 2 7 0 1 8, output should be something like:

330,22,0.004757,10.545455,18
197,19,0.002806,9.517767,13
3015,26,0.036673,10.768491,14

where values are, in order, the number of expanded nodes, the length of the optimal solution, the duration, average heuristic value and the heuristic value for the initial state.

n-tile-puzzle's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

n-tile-puzzle's Issues

How can we improve performance?

For the 3 examples of 3x3, A* took 0.0001, 0.0008 and 0.0007.
Ours is taking 0.004, 0.002 and 0.03 for these same examples.

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.