Code Monkey home page Code Monkey logo

n-puzzle's Introduction

HOW TO

  1. "source start.sh"
  2. python srcs/npuzzle.py [puzzle_file]

n-puzzle

The goal of this project is to solve the N-puzzle game using the A* search algorithm or one of its variants.

Example

X represents the empty cell

start position

5 2 9
3 X 1
8 7 4

final wanted position

1 2 3
8 X 4
7 6 5

Beginning

You start with a square board made up of N*N cells. One of these cells will be empty, the others will contain numbers, starting from 1, that will be unique in this instance of the puzzle.

Your search algorithm will have to find a valid sequence of moves in order to reach the final state, a.k.a the "snail solution", which depends on the size of the puzzle.

notes

Greedy A* is described here https://en.wikipedia.org/wiki/A*_search_algorithm#Relations_to_other_algorithms

n-puzzle's People

Watchers

James Cloos avatar Jacob Quentin avatar

n-puzzle's Issues

INPUT - Map parsing from file

A valid file map must:

  • have its first line containing the width of the puzzle
  • be squared
  • contain all numbers from 0 to (N*N) - 1

It can contain one-line comments beginning by #
It can contain different type of white-spaces

# i'm a comment
4
0 10 5 7
11 14 4 8 #i'm another comment
1 2 6 13
12 3 15 9

OUTPUT

Program must show:

  • If the puzzle is solvable
  • The detail of all sequences made to the resolution
  • How much sequences needed to resolve
  • How much states envisaged through the entire program lifetime
  • How much states envisaged at maximum for one sequence

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.