Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1000 REM WELCOME
- 1010 GRAPHICS 5
- 1020 POKE 752,1
- 1030 ? :? " KNIGHT'S TOUR"
- 1040 ? " (C) PRZEMYSLAW KOBYLANSKI 2024"
- 1050 REM BOARD
- 1060 Y=0
- 1070 FOR I=0 TO 7
- 1080 FOR K=0 TO 3
- 1090 X=0
- 1100 FOR J=0 TO 7
- 1110 SUM=I+J
- 1120 MOD=SUM-2*INT(SUM/2)
- 1130 COLOR 2+MOD
- 1140 PLOT X,Y
- 1150 DRAWTO X+3,Y
- 1160 X=X+4
- 1170 NEXT J
- 1180 Y=Y+1
- 1190 NEXT K
- 1200 NEXT I
- 1210 GOSUB 4000
- 1220 REM ARRAYS
- 1230 DIM B(7,7),C(7,7),DX(7),DY(7),S(63,8),Z(63,7),S$(130),A$(1)
- 1240 SP=0
- 1250 FOR J=0 TO 7
- 1260 FOR I=0 TO 7
- 1270 B(I,J)=0
- 1280 READ V
- 1290 C(I,J)=V
- 1300 NEXT I
- 1310 NEXT J
- 1320 FOR I=0 TO 7
- 1330 READ X,Y
- 1340 DX(I)=X
- 1350 DY(I)=Y
- 1360 NEXT I
- 1370 REM START SEARCHING
- 1400 N=1
- 1410 X=0
- 1420 Y=0
- 1430 GOTO 2000
- 1440 ? S$;" PRESS ENTER";
- 1450 INPUT A$
- 1460 POKE 53277,0
- 1470 GRAPHICS 0
- 1480 END
- 2000 REM SEARCH
- 2010 S$(2*N-1)=CHR$(65+X)
- 2020 S$(2*N)=CHR$(56-Y)
- 2030 B(X,Y)=N
- 2040 COLOR 1
- 2050 FOR I=1 TO 2
- 2060 FOR J=1 TO 2
- 2070 PLOT 4*X+I,4*Y+J
- 2080 NEXT J
- 2090 NEXT I
- 2100 IF N=64 THEN 1440
- 2110 N=N+1
- 2120 D=-1
- 2130 GOSUB 3000
- 2140 FOR I=0 TO 7
- 2150 X1=X+DX(I)
- 2160 Y1=Y+DY(I)
- 2170 TRAP 2200
- 2180 S(SP,I)=C(X1,Y1)
- 2190 GO O 2210
- 2190 GOTO 2210
- 2200 S(SP,I)=9999
- 2210 Z(SP,I)=I
- 2220 NEXT I
- 2230 FOR I=6 TO 0 STEP -1
- 2240 FOR J=0 TO I
- 2250 IF S(SP,J)<=S(SP,J+1) THEN 2320
- 2260 TEMP=S(SP,J)
- 2270 S(SP,J)=S(SP,J+1)
- 2280 S(SP,J+1)=TEMP
- 2290 TEMP=Z(SP,J)
- 2300 Z(SP,J)=Z(SP,J+1)
- 2310 Z(SP,J+1)=TEMP
- 2320 NEXT J
- 2330 NEXT I
- 2340 REM LOOK AROUND
- 2350 S(SP,8)=0
- 2360 IF S(SP,S(SP,8))>8 THEN 2590
- 2370 I=Z(SP,S(SP,8))
- 2380 D1=DX(I)
- 2390 D2=DY(I)
- 2400 X=X+D1
- 2410 Y=Y+D2
- 2420 IF B(X,Y)>0 THEN 2520
- 2430 A1=P0+16+8*Y
- 2440 A0=A1-D2*8
- 2445 POKE 53248,48+8*X
- 2450 FOR I=0 TO 7
- 2460 POKE A1+I,PEEK(A0+I)
- 2480 POKE A0+I,0
- 2490 NEXT I
- 2492 SOUND 0,9,14,100
- 2494 FOR D=1 TO 4
- 2496 NEXT D
- 2498 SOUND 0,0,0,0
- 2500 SP=SP+1
- 2510 GOTO 2000
- 2520 I=Z(SP,S(SP,8))
- 2530 D1=DX(I)
- 2540 D2=DY(I)
- 2550 X=X-D1
- 2560 Y=Y-D2
- 2570 S(SP,8)=S(SP,8)+1
- 2580 IF S(SP,8)<8 THEN 2360
- 2590 REM BACKTRACK
- 2600 S$(2*N-1,2*N)=" "
- 2610 SUM=X+Y
- 2620 MOD=SUM-2*INT(SUM/2)
- 2630 COLOR 2+MOD
- 2640 FOR I=1 TO 2
- 2650 FOR J=1 TO 2
- 2660 PLOT 4*X+I,4*Y+J
- 2670 NEXT J
- 2680 NEXT I
- 2690 B(X,Y)=0
- 2700 D=1
- 2710 GOSUB 3000
- 2720 N=N-1
- 2730 SP=SP-1
- 2740 IF SP=0 THEN 1440
- 2750 I=Z(SP,S(SP,8))
- 2760 D1=DX(I)
- 2770 D2=DY(I)
- 2780 X1=X-D1
- 2790 Y1=Y-D2
- 2800 POKE 53248,48+8*X1
- 2810 1 0 16 8 1
- 2810 A1=P0+16+8*Y1
- 2820 A0=P0+16+8*Y
- 2830 FOR I=0 TO 7
- 2840 POKE A1+I,PEEK(A0+I)
- 2850 POKE A0+I,0
- 2860 NEXT I
- 2862 SOUND 0,100,14,100
- 2864 FOR D=1 TO 2
- 2866 NEXT D
- 2868 SOUND 0,0,0,0
- 2890 GOTO 2520
- 3000 REM UPDATE COUNTERS
- 3010 FOR I=0 TO 7
- 3020 X1=X+DX(I)
- 3030 Y1=Y+DY(I)
- 3040 TRAP 3060
- 3050 C(X1,Y1)=C(X1,Y1)+D
- 3060 NEXT I
- 3070 RETURN
- 4000 REM PREPAIR SPRITE
- 4010 TOP=156
- 4020 POKE 106,TOP
- 4030 PB=TOP*256
- 4040 POKE 54279,TOP
- 4050 POKE 559,46
- 4060 POKE 623,1
- 4070 POKE 704,223
- 4080 POKE 53248,48
- 4090 POKE 53256,0
- 4100 P0=PB+512
- 4110 FOR A=P0 TO P0+127
- 4120 POKE A,0
- 4130 NEXT A
- 4140 FOR A=P0+16 TO P0+23
- 4150 READ V
- 4160 POKE A,V
- 4170 NEXT A
- 4180 POKE 53277,3
- 4190 RETURN
- 5000 REM BITMAP
- 5110 DATA 16,56,92,252,238,78,30,63
- 6000 REM COUNTERS
- 6010 DATA 2,3,4,4,4,4,3,2
- 6020 DATA 3,4,6,6,6,6,4,3
- 6030 DATA 4,6,8,8,8,8,6,4
- 6040 DATA 4,6,8,8,8,8,6,4
- 6050 DATA 4,6,8,8,8,8,6,4
- 6060 DATA 4,6,8,8,8,8,6,4
- 6070 DATA 3,4,6,6,6,6,4,3
- 6080 DATA 2,3,4,4,4,4,3,2
- 7000 REM DX & DY
- 7010 DATA 1,-2,2,-1,2,1,1,2,-1,2,-2,1,-2,-1,-1,-2
Advertisement
Advertisement