Giter Club home page Giter Club logo

bishalsarang / 8-puzzle-problem Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 292 KB

This repository contains solver to 8 Puzzle Problem using A* algorithm and manhattan distance as heuristics.

Python 100.00%
8-puzzle 8-puzzle-solver 8-puzzle-problem astar-algorithm astar-pathfinding astar-search-algorithm astar-search sliding-puzzle-game sliding-puzzle sliding-tile-puzzle ai artificial-intelligence searching-algorithms search-algorithm eight-puzzle-game state-space-search kathmandu-university

8-puzzle-problem's Introduction

Eight Puzzle Problem

The 8-puzzle consists of an area divided into a grid, 3 by 3 for the 8-puzzle. On each grid square is a tile, expect for one square which remains empty. Thus, there are eight tiles in the 8-puzzle . A tile that is next to the empty grid square can be moved into the empty space, leaving its previous position empty in turn. Tiles are numbered, 1 through 8 for the 8-puzzle, so that each tile can be uniquely identified. The aim of the puzzle is to achieve a given configuration of tiles from a given (different) configuration by sliding the individual tiles around the grid as described above.1

In this repo I'll be finding solution for 8 Puzzle Problem using A* algorithm using Manhattan distance. To build the state space tree I'll be using pydot which is a Python wrapper for graphviz.

Requirements

pydot==1.4.1

Graphviz Binary Download graphviz https://www.graphviz.org/download/

Usage

  • Download graphviz binary
  • Open solve.py and update the directory to point graphviz bin directory
# Set it to bin folder of graphviz
os.environ["PATH"] += os.pathsep +  'C:/Program Files (x86)/Graphviz2.38/bin/'
  • Install all the requirements
pip install -r requirements.txt
python main.py

The state space tree is saved as "out.png".

Screenshots

enter image description here

8-puzzle-problem's People

Contributors

bishalsarang avatar

Watchers

 avatar  avatar

Forkers

carolmariaabb

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.