
KNIGHT’S MOVE uses the movement pattern of the knight in chess to try to cover every space in a square. The program asks where you wish to start on the board, giving the vertical coordinate first, and then marks the moves as you make your way round the board.
There is a check routine to make sure you cannot cheat by making an incorrect move or land more than once on the same square. When no more squares can be visited, enter 0 as the number for the next square.
Press ENTER to replay the game or any other key and ENTER to end the game.
The graphics in line 20 are the capital I reversed with two reversed dashes (shifted) between each. In line 30 the dashes are replaced by reversed spaces. (T/S1000,ZX81 16K)
1 REM KNIGHT'S 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 PINT 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
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.