Giter VIP home page Giter VIP logo

eightpuzzlesolver's Introduction

8-puzzle solver created during AI course in university, following S. Russell and P. Norvig book "Artificial Intelligence - A Modern Approach".

C#, .NET 4.5

Includes unit tests and GUI application (WPF) for some vizualization.

gif

Implemented algorithms:

  • Iterative Deepening Search
  • A*
  • Recursive Best-First Search

A* and RBFS can be used with Manhattan Distance heuristic function or without any heuristic function.

In GUI it is possible to choose board size, from 2x2 to 5x5 (can be not square). But starting from 4x4 it may take more time (such as 2-10 minutes) to find the solution and it finishes in reasonable time not for all inputs, using RBFS (A* works too but may take too much memory and crash).

How to build

Open the .sln file in Visual Studio 2015 or later, build solution.

(some C#6 features are used, so it will not work in earlier VS versions, and because of .NET 4.5 it runs only on Win 7+. There is also win-xp branch in this repository to target .NET 4.0.)

Run EightPuzzleSolverApp (should be active by default in VS) for GUI.

Tests (xUnit.net) can be run using Visual Studio Test Explorer or ReSharper (with xUnit extension), or packages\xunit.runner.console.2.1.0\tools\xunit.console EightPuzzleSolver.Tests\bin\Release\EightPuzzleSolver.Tests.dll command.

eightpuzzlesolver's People

Contributors

alexp11223 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

eightpuzzlesolver's Issues

Loops endlessly on 4x4

The solver spins through 3x3, 4x3, and 3x4 boards to a solution nicely given any of the heuristic variations, but it spins endlessly on 4x4 boards. Was this tested?

I tried generating the board several times just in case the IsSolvable check was failing.

After playing around a little more, I did notice 4x4 puzzles being solved, but only after a 3x3 had been previously solved.

So to duplicate what I'm doing, immediately change to a 4x4 puzzle after launching the application, generate a new puzzle and try to solve. I could never get this working. Perhaps there is some initialization issue for the 4x4 code path?

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.