新しく発言する  EXIT  インデックスへ

パソコンが相手をする「オセロ・ゲーム」勝...


  パソコンが相手をする「オセロ・ゲーム」勝てるか? SECOND 2008/08/23 07:49:16 
  !続き1 SECOND 2008/08/23 07:50:29 
  │└!続き2 SECOND 2008/08/23 07:51:40 
Re: !続き1  返事を書く  ノートメニュー
SECOND <jjqdmekgpt> 2008/08/23 07:51:40
! 続き2
NEXT θ
LET t_=3-t_
FOR θ=PI/2 TO 0 STEP -PI/16
LET a=0.45*COS(θ)
DRAW koma
WAIT DELAY 0 ! 0.04
NEXT θ
NEXT i
ELSEIF PP<0 THEN
CALL QUIT ! 放棄終了。(未)
EXIT DO
END IF
ELSE
CALL GAMEOV0
CALL QUIT ! 正常終了、もう一度 OK で戻る。
EXIT DO
END IF
LOOP
LOOP

!-----
SUB GAMEOV0
SET AREA COLOR 0
PLOT AREA: XL,YC-0.9; 13,YC-0.9; 13,13; XL,13
IF U(1)=0 THEN LET U(2)=64
IF U(2)=0 THEN LET U(1)=64
LET w1$="貴方"
LET w2$="私"
IF TB<>1 THEN swap w1$,w2$
PLOT TEXT,AT XL,YC+1:"先手:"&w1$
LET GT1=GT(TB)
CALL prtime(XL+2.3,YC+1)
PLOT TEXT,AT XL,YC+2:"後手:"&w2$
LET GT1=GT(3-TB)
CALL prtime(XL+2.3,YC+2)
PLOT TEXT,AT XL,YC+3:STR$(U(TB))&":"&STR$(U(3-TB))&" ("&STR$(ABS(U(2)-U(1)))&"石差)"
IF U(1)=U(2) THEN
LET w$="引分け"
ELSEIF U(1)>U(2) THEN
LET w$="貴方 の勝ち"
ELSE
LET w$="私 の勝ち"
END IF
PLOT TEXT,AT XL,YC+4:w$
END SUB

!-----
SUB QUIT
CALL ack(4,10, "もう一度やりますか? ")
END SUB

!-----
SUB TM0
LET GTM=IP(TIME)
END SUB

SUB clock
CALL TM0
LET GD=GTM-GG
IF GD<0 THEN LET GD=GD+86400
LET GT1=GT(t_)+GD
IF t_=1 THEN CALL prtime(XL+2.3,YY) ELSE CALL prtime(XL+2.3,YC)
END SUB

SUB prtime(x,y)
PLOT TEXT,AT x,y:USING$("##",IP(GT1/60))&"分"&USING$("##",MOD(GT1,60))&"秒"
END SUB

!----------
SUB mousexy
DO
LET rb=mrb
LET lb=mlb
MOUSE POLL mx,my,mlb,mrb
IF rb<mrb THEN STOP
IF lb<mlb AND 0.5<mx AND mx<8.5 AND 0.5<my AND my<8.5 THEN
DO
LET x=ROUND(mx)
LET y=ROUND(my)
!-----
PLOT TEXT,AT XL+1.37,YY+2 :CHR$(64+x)&CHR$(48+y)
LET AR0=oth33p( CCH+t_*256+y*16+x,r$)
IF AR0=0 THEN
beep
CALL messYOU2("そこは打てません。")
EXIT DO
ELSE
CALL messYOU2("         ")
END IF
!-----
CALL blink
IF rb<mrb THEN STOP
LOOP UNTIL mlb=1 AND x=ROUND(mx) AND y=ROUND(my)
IF AR0<>0 THEN
CALL pt1
EXIT SUB
END IF
END IF
WAIT DELAY 0
CALL clock
LOOP
END SUB

SUB blink
LET θ=0
DO
LET a=0.45*COS(θ)
LET θ=θ+PI/10
DRAW koma
WAIT DELAY 0.02
CALL clock
LET rb=mrb
LET lb=mlb
MOUSE POLL mx,my,mlb,mrb
LOOP UNTIL lb<mlb AND 0.5<mx AND mx<8.5 AND 0.5<my AND my<8.5 OR rb<mrb
! erase koma
SET AREA COLOR 64
PLOT AREA:x-0.45,y-0.45;x+0.45,y-0.45;x+0.45,y+0.45;x-0.45,y+0.45
END SUB

SUB pt1
LET a=0.45
DRAW koma
END SUB

PICTURE koma
SET DRAW mode hidden !裏ページに書く
SET AREA COLOR 64
PLOT AREA:x-0.45,y-0.45;x+0.45,y-0.45;x+0.45,y+0.45;x-0.45,y+0.45
SET LINE COLOR ABS(SGN(t_-TB))
DRAW circle WITH SCALE(0.45,a)*SHIFT(x,y)
SET AREA COLOR 1-ABS(SGN(t_-TB))
DRAW disk WITH SCALE(0.92)*SCALE(0.45,a)*SHIFT(x,y)
SET DRAW mode explicit !裏ページの表示
! 続き3
  │ └!続き3 SECOND 2008/08/23 07:52:45 
  │  └!続き4 SECOND 2008/08/23 07:53:45 
  Win98SEの方で「0th33p.dllをロードできない... SECOND 2008/09/13 18:00:37 
  !コンピューターの打つ手を、ゆっくり確認出... SECOND 2008/09/13 18:50:45  (修正1回)
   └!続き1 SECOND 2008/09/13 18:52:22  (修正1回)
    └!続き2 SECOND 2008/09/13 18:53:47  (修正1回)
     └!続き3 SECOND 2008/09/13 18:55:17  (修正2回)
      └!続き4 SECOND 2008/09/13 18:56:52  (修正1回)
       └DELETED  SECOND  2008/09/13 19:28:19  (削除)

 インデックスへ  EXIT
新規発言を反映させるにはブラウザの更新ボタンを押してください。