Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/jmdeldin/sliding-puzzle
- Owner: jmdeldin
- Created: 2012-09-10T10:01:00.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-09-12T06:09:44.000Z (about 12 years ago)
- Last Synced: 2023-04-13T07:51:09.254Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 132 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
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_srcThe =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_srcYou can also run =.bin/guard= for continuous testing.
* TODO Bugs
- DFS is a little extreme
- Need to investigate h2