!<その3> SUB revcheck(x,y,col,i,j) ! 返せる石をチェック FOR k=2 TO MAX(m,n)-1 IF r(x+SGN(i)*k,y+SGN(j)*k)=board THEN EXIT FOR IF r(x+SGN(i)*k,y+SGN(j)*k)=col THEN IF sarch_on=1 THEN LET sarev=1 EXIT SUB END IF IF rev=0 THEN DRAW put(x,y,col) ! 着手点 IF putcol<>0 THEN DRAW putat(x,y) ! 着手点表示 END IF FOR k2=1 TO k-1 DRAW put(x+SGN(i)*k2,y+SGN(j)*k2,col) NEXT k2 LET rev=rev+(k-1) ! 返せる石数 EXIT FOR END IF NEXT k END SUB PICTURE put(x,y,col) ! 石の描画 SET DRAW MODE HIDDEN DRAW rect(board) WITH SCALE(0.8,0.8)*SHIFT(x+0.1,y+0.1) SET DRAW MODE EXPLICIT WAIT DELAY 0.1 IF col<>board THEN SET DRAW MODE HIDDEN SET LINE WIDTH LW SET AREA COLOR col IF bp>=15 THEN DRAW CIRCLE WITH SCALE(0.33)*SHIFT(x+0.5,y+0.5) SET DRAW MODE EXPLICIT WAIT DELAY 0.1 SET DRAW MODE HIDDEN PAINT x+0.5,y+0.5 ELSE DRAW DISK WITH SCALE(0.33)*SHIFT(x+0.5,y+0.5) END IF SET DRAW MODE EXPLICIT END IF WAIT DELAY 0.1 END PICTURE PICTURE putat(x,y) ! 着手点表示 SET DRAW MODE HIDDEN ASK PIXEL VALUE(putx+0.65,puty+0.65) apv SET POINT COLOR apv PLOT POINTS : putx+0.5,puty+0.5 SET POINT COLOR putcol PLOT POINTS : x+0.5,y+0.5 SET DRAW MODE EXPLICIT LET putx=x LET puty=y END PICTURE SUB scan ! 盤面スキャン LET countb=0 LET countw=0 FOR i=1 TO m FOR j=1 TO n ASK PIXEL VALUE(i+0.65,j+0.65) r3(i,j) IF r3(i,j)=b THEN LET countb=countb+1 ELSEIF r3(i,j)=w THEN LET countw=countw+1 END IF NEXT j NEXT i IF edit_on<>1 THEN FOR i=1 TO m FOR j=1 TO n LET rr(count,i,j)=r3(i,j) NEXT j NEXT i END IF FOR i=1 TO m FOR j=1 TO n LET r(i,j)=r3(i,j) NEXT j NEXT i END SUB PICTURE counter ! 石数表示 ASK TEXT HEIGHT ath SET TEXT HEIGHT 0.4 SET DRAW MODE HIDDEN DRAW rect(ground) WITH SCALE(m-0.9,0.8)*SHIFT(0,n+1.1) PLOT TEXT ,AT 0.75,n+1.5:cc$(b)&":"&STR$(countb) PLOT TEXT ,AT m/2+0.1,n+1.5:cc$(w)&":"&STR$(countw) SET DRAW MODE EXPLICIT SET TEXT HEIGHT ath END PICTURE !<その4>に続く
|