Weakest calculator/pocket computer that can do Tower of Hanoi?
08-29-2018, 11:32 PM
Post: #31
 SlideRule Senior Member Posts: 1,418 Joined: Dec 2013
RE: Weakest calculator/pocket computer that can do Tower of Hanoi?
OK, it took a while BUT I finally retrieved the source listing for the PC-2 (1500) HHC.
Code:
7 "HANOI TOWERS 8 "KEYS : $%& 9 "SHARPENTIERS #8 10 " "CLEAR :DIM B(7,3):E=85,U=24,B(0,1)=99,B(0,2)=99,B(0,3)=99 20 PAUSE " *** HANOI TOWERS ***":INPUT "How many discs (1-7)? ";Q:Q=INT Q:IF Q<1OR Q>7THEN 20 30 B=Q,F=2*Q+1:FOR I=1TO Q:B(I,1)=F,F=F-2:NEXT I 40 CLS :WAIT 0:FOR I=0TO Q-1:GCURSOR E-Q+I:V=V+2^(6-I):GPRINT V:NEXT I 50 FOR I=7-QTO 6:GCURSOR E+I-6+Q:GPRINT V:V=V-2^I:NEXT I:GCURSOR E:GPRINT &7F:GCURSOR E+U:GPRINT &7F:GCURSOR E+2*U:GPRINT &7F 60 S=ASC INKEY$ :IF S<20OR S>22THEN 60 70 Z=S-19:IF @(Z+1)=0THEN 110 80 BEEP 1:K=30,H=Z:GOSUB 200:GPRINT "001010103810000006520E00" 90 S=ASC INKEY$:IF S<20OR S>22THEN 90 100 X=S-19:IF Z<>XAND B(@(Z+1),Z)<B(@(X+1),X)THEN 120 110 GCURSOR 30:GPRINT "06520E00":BEEP 3:GOTO 60 120 BEEP 1:K=42,H=X:GOSUB 200 130 L=E+U*(Z-1)-INT (B(@(Z+1),Z)/2),T=L+U*(X-Z) 140 FOR M=0TO B(@(Z+1),Z)-1:N=L+M:GCURSOR N:GPRINT POINT NAND (127-2^(7-@(Z+1))):GCURSOR E+U*(Z-1) 150 GPRINT &7F:R=2^(6-@(X+1)),N=M+T:GCURSOR N:GPRINT POINT NOR R:NEXT M 160 B(@(X+1)+1,X)=B(@(Z+1),Z),B(@(Z+1),Z)=0 170 @(Z+1)=@(Z+1)-1,@(X+1)=@(X+1)+1,A=A+1 180 IF D=QCLS :WAIT :PRINT "BRAVO !!!";USING "####";A;" MOVES.":END 190 K=0,W$=STR$A:FOR I=1TO LEN W$:H=VAL (MID$(W$,I,1)):GOSUB 200:K=K+4:NEXT I:GPRINT "7848480040":GOTO 60 200 GCURSOR K:RESTORE 210+10*H:READ A$:GPRINT A$,:RETURN  210 DATA "7C447C 220 DATA "487C40 230 DATA "74545C 240 DATA "54547C 250 DATA "1C7010 260 DATA "5C5474 270 DATA "7C5474 280 DATA "04047C 290 DATA "7C547C 300 DATA "5C547C

I think my initial response was on the PRIME sub-Forum but it seemed appropriate to post the BASIC listing here.

BEST!
SlideRule
 « Next Oldest | Next Newest »

 Messages In This Thread Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-11-2018, 05:26 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-11-2018, 06:42 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-11-2018, 06:52 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-11-2018, 08:35 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 01:46 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-12-2018, 01:52 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 07:16 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 07:46 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 08:10 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 09:35 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 01:19 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 01:16 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 01:32 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 05:08 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 06:07 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Paul Dale - 08-13-2018, 01:38 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-13-2018, 03:40 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Paul Dale - 08-13-2018, 07:03 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-13-2018, 12:45 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018, 11:47 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-13-2018, 01:31 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-13-2018, 01:07 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018, 03:58 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018, 04:02 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-14-2018, 12:47 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Paul Dale - 08-14-2018, 04:18 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Jake Schwartz - 08-15-2018, 03:49 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-15-2018, 04:39 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Gene - 08-15-2018, 05:31 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-15-2018, 08:12 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-29-2018 11:32 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-30-2018, 03:36 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-30-2018, 11:57 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 10-29-2018, 02:15 PM

User(s) browsing this thread: 1 Guest(s)