Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jmdeldin/sliding-puzzle

Sliding puzzle solver for my AI class (under development)
https://github.com/jmdeldin/sliding-puzzle

Last synced: about 1 month ago
JSON representation

Sliding puzzle solver for my AI class (under development)

Awesome Lists containing this project

README

        

#+TITLE: Sliding Puzzle Solver
#+STARTUP: align hidestars indent lognotedone

* Requirements
- UNIX-like system running Ruby 1.8.7 or better (1.9.3 preferred)
This has only been tested on OS X 10.8.1.
- The =algorithms= package. This can be installed like so from the project root:

#+begin_src sh
gem install bundler # you may need to prefix this with "sudo"

bundle install --binstubs .bin
#+end_src

* Usage
From the project root, run

#+begin_src sh
bundle exec bin/solver INPUT-FILE
#+end_src

The =data= directory has plenty of examples.

* Performance on an 8-puzzle
| Algorithm | Steps | Approx. Nodes Expanded | Wall Time (s) |
|---------------+--------+------------------------+---------------|
| Breadth-First | 23 | 123,000 | 9.24 |
| Depth-First | 26,535 | 27,000 | 2.10 |
| Uniform-Cost | 1347 | 66,000 | 13.52 |
| Greedy | 211 | 145,000 | 314.33 |
| A* h1 | 91 | < 1000 | 0.25 |
| A* h2 | 1347 | 66,000 | 11.36 |

* Unit Tests
From the project root, you can run the unit tests as follows (requires Ruby 1.9):

#+begin_src sh
.bin/rspec spec # run specs
#+end_src

You can also run =.bin/guard= for continuous testing.

* TODO Bugs
- DFS is a little extreme
- Need to investigate h2