Towers

Date: 198x
Type: Program
Platform(s): TS 1000

Appears on

Assembled by Tim Ward from many sources. Contains programs 10211 – 10251.

Gallery

Towers

Source Code

   5 REM      "TOWERS"
  20 CLS 
  30 PRINT AT 20,0;"\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\''"
  35 PRINT AT 21,8;"1";TAB 16;"2";TAB 24;"3"
  40 FOR X=10 TO 19
  50 PRINT AT X,5;"   \ :       \ :       \ :"
  60 NEXT X 
  61 DIM A(3,7)
  65 DIM A$(7,8)
  67 LET A$(1)="   \ :"
  70 LET A$(2)="   % \: "
  80 LET A$(3)="  \ :% % "
  90 LET A$(4)="  % % % \: "
 100 LET A$(5)=" \ :% % % % "
 110 LET A$(6)=" % % % % % \: "
 120 LET A$(7)="\ :% % % % % % "
 130 FOR Z=7 TO 1 STEP -1
 135 LET A(1,Z)=1
 140 LET A(2,Z)=Z
 145 LET A(3,Z)=1
 150 NEXT Z
 155 LET C=1
 160 FOR Z=1 TO 3
 170 FOR Y=7 TO 1 STEP -1
 180 PRINT AT Y+12,Z*8-3;A$(A(Z,Y))
 190 NEXT Y
 195 NEXT Z
 201 PRINT AT 0,24;"MOVE: ";C
 205 IF A(1,2)=2 OR A(3,2)=2 THEN GOTO 2000
 208 PRINT AT 0,0;"            "
 210 PRINT AT 0,0;"FROM? "
 220 INPUT J
 230 PRINT AT 0,0;J;" TO ?"
 240 INPUT K
 250 PRINT AT 0,0;J;" TO ";K
 255 IF J>3 OR J<1 OR K>3 OR K<1 THEN GOTO 1000
 260 IF K=J THEN GOTO 1000
 270 FOR D=1 TO 7
 280 IF A(J,D)=1 THEN GOTO 320
 290 LET P=D
 300 LET Q=A(J,D)
 310 GOTO 340
 320 NEXT D
 330 GOTO 1000
 340 FOR D=1 TO 7
 350 IF A(K,D)=1 THEN GOTO 370
 360 IF A(K,D)<Q THEN GOTO 1000
 365 IF A(K,D)>1 THEN GOTO 380
 370 NEXT D
 380 LET D=D-1
 390 LET A(K,D)=A(J,P)
 400 LET A(J,P)=1
 410 LET C=C+1
 420 GOTO 160
1000 FOR U=0 TO 30
1020 PRINT AT 0,0;"INVALID MOVE";AT 0,0;"%I%N%V%A%L%I%D% %M%O%V%E"
1040 NEXT U
1050 GOTO 208
2000 PRINT AT 0,0;"YOU HAVE COMPLETED THE TOWERS IN";C-1;" MOVES"
2010 PRINT 
2020 PRINT "TRY AGAIN?"
2030 INPUT S$
2040 IF S$(1)="Y" THEN RUN 
2050 STOP 
2070 SAVE "1021%3"
2080 RUN 

People

No people associated with this content.

Scroll to Top