Git Product home page Git Product logo

8puzzle's Introduction

C# 8puzzle

Description

This is an example of an A* algorithim used to solve a 3x3 tile puzzle with a single tile missing (8 actual values). To solve the puzzle, tiles are rearranged by sliding tiles up, down, left, or right into the open position until the goal state is reached.

Getting Started

This is a C# Console app targeting DotNet Core

To run it just open the solution file in Visual Studio 2017 and start a debugging session, or else run the following commands from a CLI.

$> dotnet build 8puzzle.sln
$> dotnet run

Note requires DotNet Core SDK installed (included with VS2017).

Usage

User can enter a disorganized state with with the numbers 0-8 in mixed up order. The goal state for this puzzle is in text is 876543210. Graphically:

= = =
8 7 6
5 4 3
2 1 0

The most moves required to solve an 8puzzle is 31. The two states that are 31 moves out are 132745608 and 352140678.

Future enhancements

This could be expanded to have a user defined goal state, a user defined puzzle size, include a function for determining if the puzzle is solvable or not solvable (right now an unsolvable starting state will just cause it to run forever), a limit on the number moves so it doesn't run forever, the heuristic could be changed to a more traditional n-puzzle hueristic like manhattan distance or a more advanced heuristic with a learning component, adding a windows interface to show a pretty UI.

Have fun.

8puzzle's People

Contributors

kcofield avatar

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.