10 'Pocket Reversi V1.1B 20 ' 30 DIM
B0(9,9),B1(9,9),F1(7),TB(9,9),SC(64),XB(64),YB(64) 40 ' 50 CLS:PRINT
"SETUP" 60 FOR X=1 TO 8:FOR Y=1 TO 8:READ TB(X,Y):NEXT:NEXT 70
' 80 AG=&H0100 'CALL 90 CB=&H0194 'CALL BACKUP 100
CR=&H01A1 'CALL RESTORE 110 ' 120 AC=&H01AF 'COL1 '$01B0
COL2 130 AX=&H01B3 'XY 140 AF=&H01B9 'FLAG '$01A0
FLAG1 150 AR=&H01AE 'REV 160 AB=&H0200 'BAN1 170 ' 180
I=&H0100 190 *READ1 200 READ V$:IF V$<>"END" THEN
A=VAL("&H"+V$):POKE I,A:I=I+1:GOTO *READ1 210 CLS 220 ' 230
B1=TB(2,1):B2=TB(2,2) 240 T1=30:T2=10 250 ' 260 *START 270
CLS 280 LOCATE 2,0:PRINT "Pocket Reversi V1.1B" 290 LOCATE 6,2:PRINT
"1:YOU vs CPU" 300 LOCATE 6,3:PRINT "2:CPU vs YOU" 310 LOCATE
2,5:PRINT "Program By TOMOKAZU"; 320 *ST1 330 GOSUB *KEYWAIT 340
IF A<49 OR A>50 THEN *ST1 350 CLS 360 'BAN CLEAR 370 FOR
X=0 TO 8:A=AB+X :POKE A,255:NEXT 380 FOR X=0 TO
9:A=AB+X+81:POKE A,255:NEXT 390 FOR Y=1 TO 8:A=AB+Y*9 :POKE A,255:FOR
X=1 TO 8:POKE A+X,0:NEXT:NEXT 400 X1=4:Y1=4:POKE AB+X1+Y1*9,1:GOSUB
*PRTST 410 X1=5:Y1=4:POKE AB+X1+Y1*9,2:GOSUB *PRTST 420
X1=4:Y1=5:POKE AB+X1+Y1*9,2:GOSUB *PRTST 430 X1=5:Y1=5:POKE
AB+X1+Y1*9,1:GOSUB *PRTST 440 ' 450 X1=1:Y1=1 460
LINE(49,0)-(49,48) 470 X=54 480 Y=25:B=2:GOSUB *PRTS2 490
Y=33:B=1:GOSUB *PRTS2 500 GOSUB *PRT 510 CL=2:PS=0
'color,pass 520 IF A=50 THEN CY=1:GOTO *M1 ELSE CY=2 530 ' 540
*MAIN 550 ' 560 'MAN 570 GOSUB *PSCHECK 580 IF F=0
THEN 590 PS=PS+1:IF PS>=2 THEN *QUIT 600 LOCATE
9,1:PRINT "You Pass!" 610 LOCATE 9,2:PRINT "Hit Any Key":GOSUB
*KEYWAIT 620 ELSE 630 LOCATE 9,0:PRINT "You (";:GOSUB
*PRTWB 640 GOSUB *INP2 650 ENDIF 660 IF S1+S2=64 THEN
*QUIT 670 CL=(CL AND 01)+1 680 GOSUB *MSGCLR 690 ' 700
'CPU 710 *M1 720 LOCATE 9,0:PRINT "CPU (";:GOSUB *PRTWB 730 GOSUB
*CPU 740 CL=(CL AND 01)+1 750 IF S1+S2=64 THEN *QUIT 760 GOTO
*MAIN 770 ' 780 *QUIT 790 'S1:Black(1) S2:White(-1) 800 GOSUB
*MSGCLR 810 LOCATE 9,1 820 ' 830 IF S1=S2 THEN 840 PRINT
"DRAW" 850 ELSE 860 IF S1>S2 THEN 870 IF
CY=2 THEN PRINT "You Win" ELSE PRINT "You Lose" 880
ELSE 890 IF CY=2 THEN PRINT "You Lose" ELSE PRINT "You
Win" 900 ENDIF 910 ENDIF 920 ' 930 GOSUB *KEYWAIT 'OUT
A 940 GOTO *START 950 END 960 ' 970 *INP 980 GOSUB *KEYWAIT
'OUT A 990 IF A= 4 AND Y1>1 THEN Y1=Y1-1 1000 IF A= 5 AND Y1<8
THEN Y1=Y1+1 1010 IF A=14 AND X1<8 THEN X1=X1+1 1020 IF A=15 AND
X1>1 THEN X1=X1-1 1030 B=PEEK(AB+X1+Y1*9) 1040 IF A=13 AND B=0
THEN 1050 POKE AC,CL 'SET COLOR 1060 GOSUB
*CHECK 1070 IF F>0 THEN 1080
PS=0 1090
LINE((X1-1)*6,(Y1-1)*6)-((X1-1)*6+6,(Y1-1)*6+6),R,B 1100
POKE AB+X1+Y1*9,CL:GOSUB *PRTST:GOSUB *PRT 1110
RETURN 1120 ENDIF 1130 ENDIF 1140 *INP2 1150 IF
X1<>X2 OR Y1<>Y2 THEN 1160
LINE((X2-1)*6,(Y2-1)*6)-((X2-1)*6+6,(Y2-1)*6+6),R,B 1170
LINE((X1-1)*6,(Y1-1)*6)-((X1-1)*6+6,(Y1-1)*6+6),S,B 1180 ENDIF 1190
X2=X1:Y2=Y1 1200 GOTO *INP 1210 ' 1220 *CPU 1230
X3=X1:Y3=Y1 1240 CALL CB 'BACKUP 1250 CT=0 1260 POKE AC,CL 'SET
COLOR 1270 FOR X1=1 TO 8:FOR Y1=1 TO 8 1280 F=0:IF
PEEK(AB+X1+Y1*9)=0 THEN GOSUB *CHECK 1290 IF F>0
THEN 1300 CT=CT+1 1310
POKE(AB+X1+Y1*9),CL 1320 GOSUB *CALC 1330
SC(CT)=SC 1340 XB(CT)=X1:YB(CT)=Y1 1350 CALL
CR 'RESTORE 1360 ENDIF 1370 NEXT:NEXT 1380
X1=X3:Y1=Y3 1390 IF CT=0 THEN 1400 PS=PS+1:LOCATE 9,1:PRINT
"CPU PASS" 1410
LINE((X1-1)*6,(Y1-1)*6)-((X1-1)*6+6,(Y1-1)*6+6),S,B 1420
X2=X1:Y2=Y1 1430 RETURN 'PASS 1440 ENDIF 1450 ' 1460
PS=0:SC=-10000:J=1 1470 FOR I=1 TO CT 1480 IF SC(I)>SC THEN
J=I:SC=SC(I) 1490 NEXT 1500 X1=XB(J):Y1=YB(J):POKE AC,CL:GOSUB
*CHECK 1510 POKE(AB+X1+Y1*9),CL:GOSUB *PRTST 1520 GOSUB *PRT 1530
RETURN 1540 ' 1550 *CALC 1560 SC=0 1570 IF
PEEK(AB+1+1*9)<>0 THEN TB(2,1)=T1:TB(1,2)=T1:TB(2,2)=T2 1580 IF
PEEK(AB+1+8*9)<>0 THEN TB(2,8)=T1:TB(1,7)=T1:TB(2,7)=T2 1590 IF
PEEK(AB+8+1*9)<>0 THEN TB(8,2)=T1:TB(7,1)=T1:TB(7,2)=T2 1600 IF
PEEK(AB+8+8*9)<>0 THEN TB(7,8)=T1:TB(8,7)=T1:TB(7,7)=T2 1610
' 1620 FOR I=1 TO 8:FOR J=1 TO 8:B=PEEK(AB+I+J*9) 1630 IF
B<>0 THEN 1640 IF B=CL THEN SC=SC+TB(I,J) ELSE
SC=SC-TB(I,J) 1650 ENDIF 1660 NEXT:NEXT 1670 ' 1680
TB(2,1)=B1:TB(1,2)=B1:TB(2,2)=B2 1690
TB(2,8)=B1:TB(1,7)=B1:TB(2,7)=B2 1700
TB(8,2)=B1:TB(7,1)=B1:TB(7,2)=B2 1710
TB(7,8)=B1:TB(8,7)=B1:TB(7,7)=B2 1720 RETURN 1730 ' 1740
*CHECK 1750 POKE AX,X1+Y1*9:CALL AG 1760 F=PEEK(AF) 1770
RETURN 1780 ' 1790 *PSCHECK 1800 POKE AR,0 'NON REV 1810
POKE AC,CL 'SET COLOR 1820 X3=X1:Y3=Y1 1830 FOR C=3 TO 1 STEP
-1:D=(4-C)*2 1840 FOR E=0 TO D 1850 X1=C+E
:Y1=C :F=0:IF PEEK(AB+X1+Y1*9)=0 THEN GOSUB *CHECK:IF
F>0 THEN E=9:C=0:GOTO *PS1 1860 X1=9-C
:Y1=C+E :F=0:IF PEEK(AB+X1+Y1*9)=0 THEN GOSUB *CHECK:IF F>0 THEN
E=9:C=0:GOTO *PS1 1870 X1=9-C-E:Y1=9-C :F=0:IF
PEEK(AB+X1+Y1*9)=0 THEN GOSUB *CHECK:IF F>0 THEN E=9:C=0:GOTO
*PS1 1880 X1=C :Y1=9-C-E:F=0:IF
PEEK(AB+X1+Y1*9)=0 THEN GOSUB *CHECK:IF F>0 THEN E=9:C=0 1890
*PS1 1900 NEXT 1910 NEXT 1920 X1=X3:Y1=Y3 1930 POKE
AR,1 'MODE REV 1940 RETURN 1950 ' 1960 *PRT 1970
S1=0:S2=0 1980 FOR I=1 TO 8:X=(I-1)*6+2 1990 FOR J=1 TO
8:Y=(J-1)*6+2 2000 B=PEEK(AB+I+J*9) 2010 IF B<>0
THEN 2020 IF B=2 THEN LINE(X,Y)-(X+2,Y+2),S,BF:S1=S1+1 ELSE
LINE(X,Y)-(X+2,Y+2),R,BF:S2=S2+1 2030 ENDIF 2040 NEXT 2050
NEXT 2060 LOCATE 10,3:B=S1:GOSUB *NUMPRT 2070 LOCATE 10,4:B=S2:GOSUB
*NUMPRT 2080 RETURN 2090 ' 2100 *PRTST 2110 'IN X1,Y1 2120
X=(X1-1)*6+1:Y=(Y1-1)*6+1:B=PEEK(AB+X1+Y1*9)'B1(X1,Y1) 2130 GOSUB
*PRTS2 2140 RETURN 2150 ' 2160 *PRTS2 2170 'IN X,Y,B 2180
LINE(X+1,Y)-(X+3,Y) 2190 LINE(X,Y+1)-(X,Y+3) 2200
LINE(X+4,Y+1)-(X+4,Y+3) 2210 LINE(X+1,Y+4)-(X+3,Y+4) 2220 IF B=2
THEN LINE(X+1,Y+1)-(X+3,Y+3),S,BF ELSE
LINE(X+1,Y+1)-(X+3,Y+3),R,BF 2230 RETURN 2240 ' 2250
*NUMPRT 2260 'IN B 2270 V$=STR$(B):V$=LEFT$("
",2-LEN(V$))+V$:PRINT V$; 2280 RETURN 2290 ' 2300
*KEYWAIT 2310 'OUT A 2320 I$=INKEY$ :IF I$="" THEN A1=0:KB=0:GOTO
*KEYWAIT 2330 A= ASC (I$):IF A=A1 THEN KB=KB+1:IF KB<20 THEN GOTO
*KEYWAIT 2340 A1=A 2350 RETURN 2360 ' 2370 *MSGCLR 2380
LOCATE 9,1:PRINT
"
"; 2390 LOCATE 9,2:PRINT
"
"; 2400 RETURN 2410 ' 2420 *PRTWB 2430 IF CL=1 THEN PRINT
"White)"; ELSE PRINT "Black)"; 2440 RETURN 2450 ' 2460
'table 2470 DATA 60,-20, 0, -2, -2, 0,-20, 60 2480
DATA -20,-40, -3, -3, -3, -3,-40,-20 2490 DATA 0, -3,
0, -1, -1, 0, -3, 0 2500 DATA -2, -3, -1, -1, -1, -1,
-3, -2 2510 DATA -2, -3, -1, -1, -1, -1, -3, -2 2520
DATA 0, -3, 0, -1, -1, 0, -3, 0 2530 DATA
-20,-40, -3, -3, -3, -3,-40,-20 2540 DATA 60,-20, 0, -2,
-2, 0,-20, 60 2550 ' 2560 DATA
06,08,21,AF,01,7E,E6,01,3C,21,B0,01,77,4F,11,00 2570 DATA
02,2A,B3,01,19,7E,FE,00,C2,52,01,22,B5,01,22,B7 2580 DATA
01,21,B9,01,36,00,21,BD,01,22,BB,01,2A,BB,01,56 2590 DATA
23,5E,21,BA,01,36,00,2A,B7,01,22,B5,01,19,22,B5 2600 DATA
01,7E,B9,CC,53,01,2A,BB,01,23,23,22,BB,01,05,C2 2610 DATA
2C,01,C9,3A,BA,01,3C,32,BA,01,19,22,B5,01,7E,B9 2620 DATA
CA,53,01,E5,21,AF,01,4E,E1,B9,C2,8D,01,E5,21,B9 2630 DATA
01,36,01,E1,3A,AE,01,FE,01,C2,8D,01,A7,ED,52,22 2640 DATA
B5,01,71,3A,BA,01,3D,32,BA,01,C2,7C,01,E5,21,B0 2650 DATA
01,4E,E1,C9,21,00,02,11,5B,02,06,00,0E,51,ED,B0 2660 DATA
C9,21,5B,02,11,00,02,06,00,0E,51,ED,B0,C9,01,01 2670 DATA
FF,00,00,28,00,00,00,00,00,00,00,00,00,FF,F6,FF 2680 DATA
F7,FF,F8,FF,FF,00,01,00,08,00,09,00,0A,END
|