Code Monkey home page Code Monkey logo

8puzzle-statespacesearches's Introduction

8-puzzle - State Space Searches

The 8-puzzle problem consists of a puzzle composed by (n x n) - 1 tiles, numbered from 1 to n^2– 1. The last position that would define the squared form of the puzzle is an empty space, used by the attempting solver to modify the puzzle’s composition, moving one of the adjacent pieces to this space. Our goal state is achieved when every numbered piece is in ascending order and the free space located in the bottom right corner position of the puzzle. To resolve this problem, two uninformed searches (Breadth-First Search and Iterative Deepening Search) and four informed searches (Greedy Search and A* Search, each with two different heuristics) were developed.

Code Structure

Five classes build the bulk:

  • tilepuzzle.py, which given an ordered board size and a certain number of permutations to inflict unto, generates a scrambled starting state, which is solved by every algorithm;
  • checkpuzzle.py, which given a puzzle in a string format and a set of moves to do into such puzzle, checks if a goal state is obtained (which is perfect for testing purposes);
  • puzzle.py, which implements the TilePuzzle object and its methods;
  • searches.py, which is consisted by our search algorithms;
  • node.py, which implements the Node object and its methods.

From these, tilepuzzle.py, puzzle.py and checkpuzzle.py were given by the course’s tutor (Dr. Nir Oren, for the course of Foundations of AI in the University of Aberdeen) and have gone through slight modifications to accommodate the student’s resolution. The approach the student has taken goes through running every algorithm orderly, one after the other, by generating a random puzzle.

Getting Started

The software provided was entirely done in Python 2.7. To start, clone the present repository into your local machine. If you're unaware of how to achieve this, please become familiar with the mechanisms of GitHub repositories.

git clone [email protected]:thyriki/8Puzzle-StateSpaceSearches.git

Prerequisites

Ensure that you have Python 2.7 installed and properly set up.

Instructions

Navigate to the project's folder, and run the following command:

python tilepuzzle.py 3 10

According to the provided arguments, this would generate a 3 by 3 puzzle, with ten random permutations caused unto it.

Authors

For any inquiries, feel free to open up an issue.

8puzzle-statespacesearches's People

Contributors

rmssoares avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

8puzzle-statespacesearches's Issues

python package problem

Hi, thanks for you code, it's helpful. But when I run the code, I encounted the error "ModuleNotFoundError: No module named 'Queue'“ . but the "Queue" seems not a python package.
Looking forward to your reply!

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.