Giter Site home page Giter Site logo

n-puzzle-solver's Introduction

CS4006-Project

This is a an A-Star (A*) based heuristic algorithm to solve a given n-puzzle from a given start state to a given goal state. It will display all the steps it took between the start state and the goal state and the time it took to solve it.

Getting Started

  • To run this program clone the repository to your own machine with java JDK 8 or newer.
  • Compile the program in the command line or within your IDE of choice.

Running The Program

  • Run the program from the command line.
  • You will be presented with a window asking for a start state. Enter your puzzle in the format of a numbers separated by spaces. An 8-puzzle will require 9 numbers to be entered with '0' representing the empty tile i.e.
1 2 3 7 8 0 5 6 7

Equates to
1 2 3
7 8 0
5 6 7
  • You will them be prompted for the goal state which should be entered in the same format as above. Use the same size goal and start states.
  • The puzzle should complete for any complexity 3x3 in less than a second. Simple 4x4 may take longer and complex ones may take several minutes.
  • Once the solution has been reached the console will print out the steps taken to reach the goal and how long it took.

Common Start States

Input Complexity
1 2 3 7 8 0 4 5 6 Easy
3 8 1 7 5 0 2 4 6 Medium
8 6 7 2 5 4 3 0 1 Hardest

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

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.