Skip to content

Solving the n-puzzle problem using informed and uninformed search strategies

Notifications You must be signed in to change notification settings

Faisal-AlDhuwayhi/AI-Solving-n-puzzle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Artificial Intelligence | Solving n-puzzle Problem

1 Objective

The goal of the project is to build an artificial intelligent that can solve n-puzzle problem using informed and uninformed search methods.

2 Requirements

  1. Implement the n-puzzle problem.
  2. Your tool should accept n as input, along with the initial state. Initial state could be randomly generated as well.
  3. Your tool allows user to select search strategy as input.
  4. Solve the problem using the selected search strategy.

3 The Problem

Given a n×n board with n^2 tiles (every tile has one number from 1 to n^2-1) and one empty space. The objective is to place the numbers on tiles to match final configuration using the empty space. You can slide four adjacent tiles (left, right, down and up) into the empty space. Figure below shows the target when n=4. Furthermore, each state will be represented as 2D array (array[n][n]), and the transition between states will be through moving the empty square, which will have the value of 0.

Figure demonstrates the problem when n=4

You can find more details about this project in the report file.

4 Output

You should produce these Outputs at the end of the project:

  1. Total number of steps to reach solution (path cost).
  2. Total number of processed nodes until the strategy finds solution.
  3. Maximum number of nodes that have been stored concurrently.
  4. Simulation playback of the solution process showing the transitions from the initial state to the goal state. (time delay should be accepted as input)

The batch file above expresses some statistics and graphs that show and compare the results between the different algorithms. Take into concern that the results are relative to the user machine.

5 Usage

The code of the project contains third-party library of python like numpy. so you need to install it in your machine and then start working.

last thing to mention is that, it's better to include venv (virtual environment) folder when installing the project. because it has all the settings of the project you need.

You can find the source code at n-puzzle file.