★ AMSTRAD CPC ★ GAMESLIST ★ TOWERS OF HANOI (c) THE AMSTRAD USER ★

The Amstrad User
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Tower of Hanoi is an absorbing game (sec brief description in the program). It is best implemented in languages which support recursion (a subroutine or procedure calling itself) with local variables, such as PASCAL, LOGO, or BBC (Acorn) BASIC. A LOCO version by J. Hughes appeared in TAU, March 86, and the HISOFT PASCAL manual has its own version.

Our BASIC allows recursion, but does not support local variables. The problem can be overcome by programming a software stack which holds the local values while the routine is active, removing them on exit. This technique was used by Michael Byrne in his implementation in Tandy Model I BASIC, published in the (now defunct, I believe) MICRO-80. It can overcome one of the major shortcomings of traditional BASIC.

Recursion is very difficult to explain. Briefly, the routine keeps on calling itself, building up the local variables and RETURNS, until a certain condition is reached. It then starts unwinding, executing the instructions which follow the GOSUB. The program has a provision for single-stepping through the disc moves and displays the stack as it is changing, and this could help to clarify the workings.

The program comes in two parts: part one has the setting up routines and the recursive and manual modes, and will run as it is; part two contains two other implementations I have come across, and is intended to be merged with part one.

TAU

TOWERS OF HANOI
(c) THE AMSTRAD USER

A BASIC version from Petr Lukes

★ YEAR: 1987
★ LANGUAGE:
★ GENRE: BASIC , BOARD , REFLEXION
★ LiCENCE: LISTING

 

★ AMSTRAD CPC ★ DOWNLOAD ★

Aucun fichier de disponible:
» Vous avez des fichiers que nous ne possédons pas concernent cette page ?
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce jeu ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 223 millisecondes et consultée 1074 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.