Code Monkey home page Code Monkey logo

fifteenresolver's Introduction

FifteenResolver

How to use:

python fifteenresolver.py <strategy> <strategy_option> <input_file>

Example:

python fifteenresolver.py bfs RLDU 4x4_01_00001.txt

Where:

Strategy Acronym
breadth-first search bfs
depth-first search dfs
A-star (heuristic) astr
Strategy option Acronym
order of searching (bfs, dfs) permutation of U, L, D, R letters
heuristic - Hamming metric hamm
heuristic - Manhattan metric manh

Input file:

first line: <number_of_rows> <number_of_columns>
next lines: <puzzle_matrix>

For puzzle 2x2 we count tiles as follows: 1,2,3,0, where 0 is the missing tile.

Example file with 4x4 puzzle:

4 4
1 2 3 4
5 6 7 8
9 10 11 0
13 14 15 12

Program will solve the puzzle to match target state:

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 0

After running this script, two directories will be created - solutions and stats.
Files in solutions contain solution length in first line and solution path in second line.
Files in stats contain:

  • solution length
  • visited states count
  • explored states count
  • max achieved length
  • time (in miliseconds)

Also, you can use batchresolver.py to generate solutions and statistics for every file in test_files directory.
To generate csv with statistics (15data.csv), use writecsv.py script.
To generate plots, use generateplots.py script (generated plots will be in plots directory).

fifteenresolver's People

Contributors

wiozak avatar

Watchers

 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.