vodinhvien / Tower_Of_Hanoi

Tower of Hanoi Interactive Visualization using GLUT,OPENGL and fundamentals of Computer Graphics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tower_Of_Hanoi

A Implementation of the mathematical game Tower Of Hanoi.


Description:

Tower of Hanoi Interactive Visualization using GLUT,OPENGL and basic fundamentals of Computer Graphics.

Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:

1) Only one disk can 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 (3rd stack) i.e. a disk can only be moved if it is the  uppermost disk on a stack.
3) No disk may be placed on top of a smaller disk.

Technology stack:

C++,OPENGL,GLUT


Methodology:

1.Line drawing Algorithm
2.Circle drawing algorithm
3.Ellipse drawing algorithm
4.Polygon filling algorithm
5.Tower of Hanoi algorithm


Implementation:

1.Line drawing algorithm for drawing the towers.
2.Circle and Ellipse drawing algorithm for drawing the disk.
3.Polygon filling algorithm for filling colors in tower and disk.
4.Tower of Hanoi algorithm for demonstrating the visualization with the help of user interactivity.


Running the code:

1. Download the repository.
2. Open DEVC++ IDE and and load the code.
3. To setup OPENGL in C++ refer https://www3.ntu.edu.sg/home/ehchua/programming/opengl/HowTo_OpenGL_C.html
4. To move a disk from one tower to another drag and drop the particular disk on desired tower.
5. Once all disks are moved to third tower the game terminates by displaying total moves and time taken.
6. To get a demo you can run the .exe file of the repository.

Authors:


About

Tower of Hanoi Interactive Visualization using GLUT,OPENGL and fundamentals of Computer Graphics.


Languages

Language:C++ 100.0%