Towers of Hanoi
Towers of Hanoi
Typed in from SYNTAX Oct. 1984 magazine. Enjoy this program!
- Attachments
-
- Towers of Hanoi.p
- (6.89 KiB) Downloaded 252 times
Re: Towers of Hanoi
Hi,
It was a little bit buggy (movements from empty locations, missing column control at the end)
Zsolt
It was a little bit buggy (movements from empty locations, missing column control at the end)
Code: Select all
515 IF P(10,C)=0 THEN GOTO 800 ; disable moves from empty positions -> see pictures TOH1,TOH2,TOH3
690 IF (R=6) AND (C<>1) THEN GOTO 720 ; check the column too -> see picture TOH4
780 PAUSE 4E4 ; here was E4E
820 SAVE "TOWER[S]" ; the autorun is activated :-)
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]
Re: Towers of Hanoi
Thanks!
The author, himself, confessed that this program needed more error-checking sections, error traps and add an anti-cheating loop putting the piece back and charge a player two moves. And try to use less array space without changing the 10 by 23 part of the DIM statements. Does N$ need 9-charactor strings? Does P need to be a number (7 bytes for each location)?
I think that the program is real cool.
The author, himself, confessed that this program needed more error-checking sections, error traps and add an anti-cheating loop putting the piece back and charge a player two moves. And try to use less array space without changing the 10 by 23 part of the DIM statements. Does N$ need 9-charactor strings? Does P need to be a number (7 bytes for each location)?
I think that the program is real cool.
Re: Towers of Hanoi
I always enjoy a good (or bad!) pun, and PAUSE 4E4 is one of the best.
4E4
geddit? forever? Hehe.
4E4
geddit? forever? Hehe.
Re: Towers of Hanoi
4e4, which is def. not forever.
"Just" 13 minutes and 20 sec.
(@ 50 Hz)
"Just" 13 minutes and 20 sec.
(@ 50 Hz)
Re: Towers of Hanoi
The author decided to use this line (PAUSE 4E4) two times for his game program. He also wrote the same exact game program for the TS2068. He also had a solution to this game. Anybody want the TS2068 program or the solution, please let me know.
Re: Towers of Hanoi
Scanned SYNTAX Oct. 1984 game program for TS1000,TS1500 and TS2068.
Re: Towers of Hanoi
Sorry Dr. Beep, that's wrong.dr beep wrote:4e4, which is def. not forever.
"Just" 13 minutes and 20 sec.
(@ 50 Hz)
According to the manual (Chapter 19 - Time & motion)
4E4=40000 > 32767"PAUSE n
stops computing & displays the picture for n frames of the television (at 50 frames per second, or 60 in America). n can be up to 32767, which gives you just under 11 minutes; if n is any bigger then it means 'PAUSE for ever'.
PAUSE 4E4 is commonly used to wait for any keypress (which terminates the "forever" PAUSE).
Siggi
http://www.worldofspectrum.org/ZX81BasicProgramming/
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Towers of Hanoi
Busted as a Spectrum-starter where we use PAUSE 0siggi wrote:Sorry Dr. Beep, that's wrong.dr beep wrote:4e4, which is def. not forever.
"Just" 13 minutes and 20 sec.
(@ 50 Hz)
According to the manual (Chapter 19 - Time & motion)4E4=40000 > 32767"PAUSE n
stops computing & displays the picture for n frames of the television (at 50 frames per second, or 60 in America). n can be up to 32767, which gives you just under 11 minutes; if n is any bigger then it means 'PAUSE for ever'.
PAUSE 4E4 is commonly used to wait for any keypress (which terminates the "forever" PAUSE).
Siggi
http://www.worldofspectrum.org/ZX81BasicProgramming/
Re: Towers of Hanoi
Hi,
This project inspired me to create an 1k version of the game (before Pokemon asks, "just because" ).
The first attempts in BASIC were unsuccessful, so I wrote a machine code version (see TOH1Kgzs.P in the attachment).
But now i am proud to present a well playable, fast enough 1K BASIC variant:
- all necessary parameters of the game board (and the disk-shapes too) are stored in a long string
- the numerical constants come from character-code expressions or from some simple functions using PI
This little video shows both games in action.
Enjoy,
Zsolt
ps: I found some other variants from 80's:
on Simon Holdsworth's page a solver
on Berto's ZX-81 Page a game
on Old Games Finder
- a game: "Tower of Hanoi, The (1983)(Kenneth Baker).zip"
- a solver: "Towers of Hanoi (19xx)(Logical Computers).zip"
on THE TYPE FANTASTIC a game
This project inspired me to create an 1k version of the game (before Pokemon asks, "just because" ).
The first attempts in BASIC were unsuccessful, so I wrote a machine code version (see TOH1Kgzs.P in the attachment).
But now i am proud to present a well playable, fast enough 1K BASIC variant:
- all necessary parameters of the game board (and the disk-shapes too) are stored in a long string
- the numerical constants come from character-code expressions or from some simple functions using PI
This little video shows both games in action.
Enjoy,
Zsolt
ps: I found some other variants from 80's:
on Simon Holdsworth's page a solver
on Berto's ZX-81 Page a game
on Old Games Finder
- a game: "Tower of Hanoi, The (1983)(Kenneth Baker).zip"
- a solver: "Towers of Hanoi (19xx)(Logical Computers).zip"
on THE TYPE FANTASTIC a game
- Attachments
-
- TowerOfHanoi1K.zip
- (42.97 KiB) Downloaded 269 times
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]