TOWER OF HANOI GAME IN C
5 Feb 2012, I thought to develop a game, Tower of Hanoi.
But I had a problem; I didn’t know much about graphics programming in C. Since
I had decided, I was not in a mood to drop this project only because of
graphics. There are other ways to make a game, i.e text based game which uses
ASCII characters to display game. Actually this isn’t my first text based game
(I have a collection like Sokoban, Bollywood Film name GuessGame, MindReader,
Tic Tac Toe (GUI,CUI both) and many other programs.) but the first one that I
am sharing with you.
I hope you know about ‘Tower of Hanoi’ game and its rule. If not, then read
it in brief.
In this game you are given with N number of discs and 3
towers; say A, B and C. These N discs are arranged in increasing order of their
diameter from top to bottom. If all discs are in Tower A then your goal is to
move all the discs in Tower C using auxiliary Tower B. Restrictions to play and
win this game are
1.) To
win this game you must place all the discs in Tower C.
2.) You
cannot move a disc of larger diameter onto a disc of smaller diameter in any of
the towers.
Features
of my Tower of Hanoi game:
1. Supports
upto 8 disks (limited to 8 because of limited screen width).
2. Allows
you to play.
3. Move
discs in animated way.
4. If
you fail to solve a game, you can let this game to solve it for you.
5. Source
code is available for learning purpose.
In
this game I have used Stack data structure, which is not strictly implemented.
At few places in code I have used stack like an array (i.e. fetched data
without using pop function of stack). I have done it just for my convenience.
Screenshot
of ‘Tower of Hanoi’ game. (Download zip)
Program when running |
can u give the source code
ReplyDeleteI have already shared source code on 4shared.com. see Download zip link above in the blog. Thanks for your interest.
DeleteI have already shared source code on 4shared.com. see Download zip link above in the blog. Thanks for your interest.
Deletehi can you please upload that zip again ?
ReplyDeletei really need that
download zip link isnt valid
could you please send it if you have already did it
Delete