Coder Social home page Coder Social logo

tower-of-hanoi-in-oop-cpp's Introduction

Tower of Hanoi

A mathematical game developed in Object Oriented C++

Game description

Tower of Hanoi is a mathematical game or puzzle consisting of three rods and a number of disks of various diameters, which can slide onto any rod. The puzzle begins with the disks stacked on one rod in order of decreasing size, the smallest at the top, thus approximating a conical shape. The objective of the puzzle is to move the entire stack to the last rod, obeying the following rules:

1- Only one disk may be moved at a time.
2- Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack or on an empty rod.
3- No disk may be placed on top of a disk that is smaller than it.

1_4fIwfKZCHzKGgPanAeWUnA

How the code operates

The code is devided into classes. A class for cubes,a class for stacks(a stack of cubes), a class for the game (containting 3 stacks) and an HSLAPixel class used for coloring the cubes. When you build the code using make all and then run the game with ./main. All the cubes start on the left rod according to the rules of the game and the game is solved automatically for you, showing each move in the terminal.

Screenshot below shows part of the steps leading to the final output.

Screen Shot 2022-02-09 at 4 56 41 PM

tower-of-hanoi-in-oop-cpp's People

Contributors

hussainaloum avatar

Watchers

 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.