NOV-DEC 1979

advertisement
NOV-DEC 1979
Volume8 Number3
Nov-Dec1979
SprckrlFrctures
14
24
40
SEEWHATYOU HEAB& HEARWHATYOU SEE by Herbl\Ioore
lVakingmusicwith the newAtari
GAMESTO PROGRAM by Heden Kohl
A Shogivariation
CRYPTARITHMS bv John Ddvenoort
Crehore
Thevenerable
NineHeximpartswisdom
INTERRUPT by WarwickSloush
Securitysystems
andSwiss-style
swindles
FORTAANMAN by ToddVorosandLeeSchneider
Our hero'smemoryis B ESTOREd
TEXASINSTRUMENTS
GRAPHICS
& ANIMATION bYDonInman
Creatinsnewcharacters
on the Tl99/4
,,4rticles
1l
16
25
2A
44
49
56
W
MATCHME by Don Inman
Komputingfor kindergarten
kids
THEJOYOF SOUND by DocPiumber
Chipmunks,lasers,
bombsandmusic
CALENDAR by H. FrankAnderson,lV,D
A technological
Stonehenge
APPL€ll'S THREElvl'S bv ChuckCarDenter
Ivemory,monitorandmachin€languagei
the conclusion
A NEWALGORITHMFOBCHESS by DavidChelburs& DavidWalters
{Part4) Thedvnamic evaluatioo
WORKSHOPS
BEATMATH ANXIETY by SlanleyKos€lman
MAKINGMUSICON THE PET by AltredJ. Bruey
Hardware.
softwareandsimoletunes
TO RECnEATIONALDISPUTING by JohnHirsch
AN INTRODUCTION
TheRDShasonlvon€bv-law
Gomes& Stutf
27
34
46
47
54
55
63
TRS-80:ELEMENTARY
MATH by Kar€nChepko
Herfirst programk a winner
TRS"8o:TOWEBOF HANOI by HerbertL Dershem
Animationfor an ancientgame
TBS.80-BINGO bv KarenChepko
A micro-lesson
in advanc€d
BASIC
TRS-8o|LOANPAYMENT by ft4ilan
Chepko
A uniqie commercial
application
CHOOSE-A-TITLE bv JackA Tavlor
673.920differenttitlesareoossiblol
NEWETTAWL'SGOATONCEAGAIN by BrianYanny
Results
of a summerschoolproject
COMPUTE.A.TICKETby DavidJ. Beard
Gonerate
ticketsfor anygoodevenl
GAME by Kathy Burk and RachelWasserman
AMINAL: A COMPUTER
A Challens€
by kidsfor kids
Deportrnents
ps,28
59
61
EDITORS'NOTES& LETTERS
REVIEWS
ANNOUNCEMENTS
TRS-80'
TO\I{ER OF HANOI
BY H ERBERTL. DERSHEM
Severclissucsaso \\)epublishen4 coupleof prcgramexamptes
usingrccu^ion. ^t that time, we ask d if anyonehad other
that w?ft basedon rctu^iv( pro'
hon, tunfutff applicotions
cedwe!. To\rer ol Jlanoi, as Uesentedhere, makesexce ent
use 01 a rccuni,e techniquefor implementingthe "morc"
secnono1 the prosam
But, be'Mrc!! If yow nicro doesnot havea recuniveDASIC,
thit ptoglom wi not work lbr fou as it is witten. You will
RZ
haw Iu ahethnes1000-)140.
This programis a versionof the Toiverof Hanoipuzzle,also
conmonly known as DonutsGee"Donutsfor Kids" bv Ron
Sonrote in CabulLtorclconpr,eru, Novenber, 1977). The
puzzie consistsof N doughnutshapeddiscs,of different
diamerers,
and lhree v€rticallowerson which tlle discscan
be plNccd.The problem beginswith a[ the discson the left'
mosl of the three towers,calledTower i. The largerdisos
areat the botlom ofthe stack.
The object is to move a of the discsfrom Tower I to Tower
2, ihe middle ol the threetowers.Thereare threerulesto
fo ow in rnovingth€ dkcs:
t) only onedisccanbe movedat a time.
2) A discis movedby removingit from the top of the stack
of discsof onetower.nd placingit on the top of a stack
of discsof anothertower.
3) No discmay everbe placedon top of a srnallerdisc.
34
BECFIEATIONALCO]VPUTING
The programgivenher€is writlen in LevelII BAS]Cfor tlre
Radio ShackTRS'80. The userhas the options ol solving
the puzzlehimselfor watchinsthc conrPulersolvcit lr
either case,the userhrs the choiceol the numbcrof discs
to be used,up to a maxinrumof I5. Theprcg.rmalsoprcvides
a time estimatefor how long the solutionwill i:rkc.This is
helpfulin the caseof 15 discswhcrcat leasl32,767rrrc'ves
thc lLtTTlc-Lhcuser
ar€ required.when the compulersoLves
has the optjon of contlollingthe lcnglh ol tirnc betwcen
moves.This fealureis helptul for (lcmo slniio'r purlxxcs.
The methodusedby the conpuieris rectlsive,whicl' mcans
that the routine10 determirethe orovescallsuponitscll.The
basicprincipleherejs thal ifyou havea roulincto succcss{ullv
moven- I discsfrom Toweri to Towcrj, ior lry i andi, tl'on
you can moven discsfrom lower i to Towe. iby ihc fol
lowingprocedure:
l) Moven-l discsfrom Toweri to Towerk.
2) MoveI disclrom Toweri to Towerj.
3) Moven-l discsfrom Towerk to roweij.
'rherek is the nurnberof th€ Towetwhichis not Toweri or
procedurc
Towerj. In otherwotds,k - 6 - i -j. Thisreculsive
1000-1100.
is sho\lnin statements
Thjs programhasbeenusedwith studenisat boih rhc clemeo_
tary and the secondarylevei. The puzzlejs explainedby
strowingthe studentsth€ computorsolutionwith threediscs.
Usually,about a thre€ scconddelay is requ€siedbeiween
of eachnove canbe giv€n.Fol_
movesso that an explanation
lowingthis, the studenlsare askedto solvethe puzzlewith
four discsand comparetheir numbcrof movesio what the
ldes o rtterthey
computerreportsasopiimrm. Aiter several
moves,
they watohthe
number
of
the
optimum
do obtaln
computersolvethe puzzlefor four discs,andthen go on to
try it for five.After theoptimumeffort for five discsis found,
on the eforl needed
to conjeciure
thestudents
areencouraged
for six or more. For a iargernumberof discs,runnitg th€
program at least to the point where tie time estimate is
p.oducedis alsointeresting.
TO\IER LISTING
,
:
E
a
a
- . o 3 o 6 i H a . 3 o 3 ? I - -3 r 3 - P P P = j ; 3 : 3
z ? ? ? ' ? 2 - = e ? " E = " - ' ; t ; ; ^ ^ . 3 = ; :; 9 ;
3 9 < a 6 zj 3 a = 3 6 = * : - 3 i 3 3 9 9 9 ; d . * 9 A 3
NOV.DEC
1979
Download