CodeBase - Recursive Functions: The Towers of Hanoi

Return to the CodeBase listing

Category: Complete Applications

Version: 1.1

0
0

Information

Uploaded: 24th Jun 2007 21:29

Modified: 25th Jun 2007 22:40

Author:  Libervurto

Summary

The Towers of Hanoi Problem: the computer completes the puzzle using an example of recursive function calling. [EDIT] The program will now set itself a new challenge each time it completes the puzzle!

Full Description

The classic puzzle where you have 3 ever decreasing rings and 3 poles, the aim being to move all three rings from the left poles to the far right by only moving one ring at a time and only placing a ring on an empty pole or larger ring.<br /> I got the pseudo code for this out of a book, it was pretty difficult transferring it to BASIC and working out how to display it. I still don't quite understand the implementations for recursive functions, though as you can see they are extremely clever and economic.

Comments

No comments yet.