一个围棋对弈程序 国防科大 陈 放 1993-03-05 10 DIM ST(60,1):KEYOFF:N=2:T=0:WIDTH40:CLS 20 A$=CHR $(195)+STRING $(17,CHR$(197)+CHR$(180) 21 B$=CHR $(218)+string $(17,CHR$(194)+CHR$(191) 22 C$=CHR $(192)+STING $(17,CHR$(193))+CHR$(217) 25 FOR I=5 TO 21;LOCATE I,11:PRINT A $:NEXT 26 LOCATE 4,11:PRINT B$:LOCATE 22,11:PRINT C$ 30 X=10:Y=10:LOCATE 24,10:PRINT"PLAYER'STRUN" 35 N=1-(N=1):LOCATE 24,18:PRINT CHR $(N); 40 P=SCREEN(Y+3,X+10);COLOR 31,0:LOCATE Y+3,X+10:PRINT CHR $(P) 50 IF K$<>CHR $(13) THEN 55 ELSE SOUND 300,1:COLOR 7,0:LOCATE Y+3,X+10:PRINT CHR $(N):GOTO 35 55 IF K$<>"T" THEN 60 ELSE IF P<3 THEN GO SUB210:GOTO 40 60 DX=X+(K$="J")-(K$="L"):DY=Y+(K$="I")-(K$="K"):IF DX<1ORDX>19 OR DY<1ORDY>19 THEN b EEP:GOTO 45 70 COLOR 7,0:LOCATE Y+3,X+10;PRINT CHR $(P):X=DX:Y=DY:GOTO 40 100 COLOR 7,0:LOCATE 24,1: END 210 GO SUB 505:C1=N 220 IF Y>1 THEN Y=Y-1:GO SUB 500:Y=Y+1 221 IF X<19 THEN X=X+1:GO SUB 500:X=X-1 222 IF Y<19 THEN Y=Y+1:GO SUB 500:Y=Y-1 223 IF X>1 THEN X=X-1:GO SUB 500:X=X+1 230 IF T=0 THEN RETURN 235 T=T-1:X=ST(T,0):Y=ST(T,1) GOTO 220 500 IF SCREEN(Y+3,X+10)<>C1 THEN 520 501 STr(T,0)=X:ST(T,1)=Y:T=T+1 505 MX=-(X>1 AND X<19):MY=-(Y>1 AND Y<19) 510 B=(X+Y=2)*218+(X+Y=38)*217+(X=MY)*195+(Y-X=18)*192+(Y=MX)*194=(X-Y=18)*191+(MY+X=20)*180+(MX+Y=20)x193-(MXAN DMY)*197 515 color 7,0:locate y+3,x+10:print chr $(-b):sound100,1 520 return