--- title: "Knight’s Move" type: "article" slug: "knights-move" url: "http://localhost/article/knights-move/" markdown_url: "http://localhost/article/knights-move.md" published_at: "2020-10-27T17:09:15+00:00" modified_at: "2025-09-24T13:05:12+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "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…" category: - name: "Timex Sinclair User" slug: "timex-sinclair-user" taxonomy: "category" url: "http://localhost/category/periodicals/timex-sinclair-user/" post_tag: - name: "1983" slug: "year-1983" taxonomy: "post_tag" url: "http://localhost/tag/year-1983/" - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" publication: "Timex Sinclair User" publication_r: id: 10278 title: "Timex Sinclair User" type: "periodical" url: "http://localhost/periodical/timex-sinclair-user/" volume: "1" issue: "2" issues_articles: - id: 26867 title: "Timex Sinclair User n2" type: "issue" url: "http://localhost/issue/timex-sinclair-user-n2/" pages: "36" pubdate: "July 1983" archive_link: false volumeissue: "v1n2" article_media: - id: 60639 title: "Knight’s Move" type: "computer_media" url: "http://localhost/computer_media/knights-move-2/" --- # Knight’s Move 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) ## Source Code: 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;" " 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;" " 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 ```