Knights Move

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

Appears on

Assembled by Tim Ward from many sources. Contains programs 10122 – 10175.

Gallery

Knights Move

Source Code

   1 REM KNIGHTS MOVE
  10 DIM B(8,8)
  20 LET A$="%I%-%-%I%-%-%I%-%-%I%-%-%I%-%-%I%-%-%I%-%-%I%-%-%I"
  30 LET B$="I% % I% % I% % I% % I% % I% % I% % I% % I"
  40 CLS 
  50 FAST 
  60 PRINT TAB 6;"1  2  3  4  5  6  7  8"
  70 PRINT TAB 5;A$
  80 FOR L=1 TO 8
  90 PRINT TAB 3;;L;" ";B$;TAB 5;A$
 100 NEXT L
 110 FOR L=1 TO 8
 120 FOR C=1 TO 8
 130 LET B(L,C)=0
 140 NEXT C
 150 NEXT L
 160 LET M=0
 170 SLOW 
 180 PRINT AT 20,0;"WHERE DO YOU WISH TO BEGIN?"
 190 INPUT C$
 200 GOSUB 410
 210 IF L=9 THEN GOTO 180
 220 LET M=M+1
 230 PRINT AT L*2,C*3+3;M
 240 IF M<10 THEN PRINT AT L*2,C*3+4;" "
 250 LET L1=L
 260 LET C1=C
 270 LET B(L,C)=1
 280 IF M<64 THEN GOTO 310
 290 PRINT AT 20,0;"CONGRATULATIONS"
 300 GOTO 490
 310 PRINT AT 19,0;" 10 SPACES "
 320 PRINT AT 20,0;"WHERE DO YOU WISH TO GO NEXT?"
 330 INPUT C$
 340 IF C$="0" THEN GOTO 490
 350 GOSUB 410
 360 IF L=9 THEN GOTO 320
 370 IF L=L1-2 OR L=L1+2 AND C=C1-1 OR C=C1+1 THEN GOTO 220
 380 IF L=L1-1 OR L=L1+1 AND C=C1-2 OR C=C1+2 THEN GOTO 220
 390 PRINT AT 19,0;"IMPOSSIBLE"
 400 GOTO 320
 410 PRINT AT 20,0;" 28 SPACES   "
 420 IF LEN C$<>2 THEN GOTO 470
 430 LET L=VAL C$(1)
 440 LET C=VAL C$(2)
 450 IF L<1 OR L>8 OR C<1 OR C>8 THEN GOTO 460
 452 IF B(L,C)=1 THEN GOTO 460
 454 RETURN 
 460 LET L=9
 470 PRINT AT 19,0;"IMPOSSIBLE"
 480 RETURN 
 490 PRINT AT 21,0;"NL TO REPLAY"
 500 INPUT C$
 510 IF C$="" THEN GOTO 40
 520 STOP 
 600 SAVE "1013%3"
 700 RUN 

People

No people associated with this content.

Scroll to Top