Giter Site home page Giter Site logo

arasgungore / n-puzzle-solver Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 1.0 216 KB

A C++ project which efficiently solves any given N-puzzle using backtracking on a decision tree.

License: MIT License

C++ 100.00%
15-puzzle 15-puzzle-solver n-puzzle backtracking decision-tree terminal-based tree tree-structure game cpp

n-puzzle-solver's Introduction

N-puzzle-solver

A C++ project which efficiently solves any given N-puzzle (aka 15 puzzle) using a backtracking algorithm on a decision tree.

Run on Terminal

g++ Header/*.cpp main.cpp -std=c++11 -o test
test

Description

In this project, the main objective is developing a program that solves the puzzle game, whose rules are as follows:

  • Game table is an NxN table whose cells are filled with numbers from 1 to (N^2 − 1), and the remaining one is blank.
  • Only the blank box can be moved on the table and the moving direction can be either horizontal or vertical (diagonal moves are not possible).
  • When the blank box is moved, the blank one and the box in the destination position of the blank box are swapped.

Output

The program will write all steps without blank spaces or newline characters. Starting from the initial configuration:

  • For LEFT move, the program will write letter L,
  • For RIGHT move, the program will write letter R,
  • For UP move, the program will write letter U,
  • For DOWN move, the program will write letter D on the terminal.

Further Notes

This project was assigned for the Introduction to Object-Oriented Programming (CMPE 160) course in the Spring 2019 semester. Upon completion of the project, as stated in the introduction of the project description, this project has challenged me to build a chess bot using decision trees from scratch (minus the alpha-beta pruning algorithm), which you can find it here.

Author

👤 Aras Güngöre

n-puzzle-solver's People

Contributors

arasgungore avatar kodlayanfahriye avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

angadjeet

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.