Towers of Hanoi

General games-related topics
Post Reply
dessony
Posts: 342
Joined: Tue Oct 29, 2013 2:26 pm
Location: Indiana, USA

Towers of Hanoi

Post by dessony »

Typed in from SYNTAX Oct. 1984 magazine. Enjoy this program! :)
Attachments
Towers of Hanoi.p
(6.89 KiB) Downloaded 252 times
User avatar
zsolt
Posts: 214
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: Towers of Hanoi

Post by zsolt »

Hi,
It was a little bit buggy (movements from empty locations, missing column control at the end)
TowersOfHanoi.zip
so i made some little changes
(8.02 KiB) Downloaded 246 times

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 :-)
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]
dessony
Posts: 342
Joined: Tue Oct 29, 2013 2:26 pm
Location: Indiana, USA

Re: Towers of Hanoi

Post by dessony »

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)? :idea:

I think that the program is real cool. 8-)
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Towers of Hanoi

Post by sirmorris »

I always enjoy a good (or bad!) pun, and PAUSE 4E4 is one of the best.

4E4

geddit? forever? Hehe.
dr beep
Posts: 2076
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Towers of Hanoi

Post by dr beep »

4e4, which is def. not forever.
"Just" 13 minutes and 20 sec.
(@ 50 Hz)
dessony
Posts: 342
Joined: Tue Oct 29, 2013 2:26 pm
Location: Indiana, USA

Re: Towers of Hanoi

Post by dessony »

The author decided to use this line (PAUSE 4E4) two times for his game program. :arrow: 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.
dessony
Posts: 342
Joined: Tue Oct 29, 2013 2:26 pm
Location: Indiana, USA

Re: Towers of Hanoi

Post by dessony »

Scanned SYNTAX Oct. 1984 game program for TS1000,TS1500 and TS2068.
Printed T o H.pdf
T o H
(472.17 KiB) Downloaded 303 times
User avatar
siggi
Posts: 990
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: Towers of Hanoi

Post by siggi »

dr beep wrote:4e4, which is def. not forever.
"Just" 13 minutes and 20 sec.
(@ 50 Hz)
Sorry Dr. Beep, that's wrong.
According to the manual (Chapter 19 - Time & motion)
"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'.
4E4=40000 > 32767

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
dr beep
Posts: 2076
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Towers of Hanoi

Post by dr beep »

siggi wrote:
dr beep wrote:4e4, which is def. not forever.
"Just" 13 minutes and 20 sec.
(@ 50 Hz)
Sorry Dr. Beep, that's wrong.
According to the manual (Chapter 19 - Time & motion)
"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'.
4E4=40000 > 32767

PAUSE 4E4 is commonly used to wait for any keypress (which terminates the "forever" PAUSE).

Siggi

http://www.worldofspectrum.org/ZX81BasicProgramming/
Busted as a Spectrum-starter where we use PAUSE 0
User avatar
zsolt
Posts: 214
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: Towers of Hanoi

Post by zsolt »

Hi,

This project inspired me to create an 1k version of the game (before Pokemon asks, "just because" :mrgreen: ).
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: :D

- 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
TOH1KBAS_5D.png
TOH1KBAS_5D.png (38.61 KiB) Viewed 5828 times
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)]
Post Reply