WindowWidth = 600 WindowHeight = 600 nomainwin dim bord(9),leeg(9) for x=0 to 2 for y=0 to 2 button #m.b,str$(x+3*y+1),bttn,UL,x*200,y*200,200,200 maphandle #m.b,"#m.b";x+3*y next y next x global human,comp,player human=0 comp=1 open "NOT 3" for window as #m #m "trapclose [quit]" #m "font Corier_new 90 bold" #m "setfocus" call newgame wait sub bttn h$ q=val(right$(h$,1)) if bord(q) then notice "Move your X on a empty place !!" exit sub end if #h$ , "X" notice "You pressed button ";q+1 player=comp end sub sub ai tel=0 for i=0 to 8 if not(bord(i)) then leeg(tel)=i tel=tel+1 end if next i for i=0 to tel dice=int(rnd(0)*tel) h=leeg(dice) leeg(dice)=leeg(i) leeg(i)=h next i for i=0 to tel bord(leeg(i))=1 if not(anyrow()) then fl=i goto [zetfount] end if bord(leeg(i))=0 next i fl=int(rnd(0)*tel) [zetfount] notice "I move on ";fl+1 h$ = "m.b";fl #h$ , "X" player=human end sub function row(a,b,c) row=bord(a)and bord(b)and bord(c) end function function anyrow() anyrow=row(0,1,2) _ or row(3,4,5) _ or row(6,7,8) _ or row(0,3,6) _ or row(1,4,7) _ or row(2,5,8) end function sub newgame for i=1 to 9 bord(i-1)=0 '' #m.b;i,str$(i) next i confirm chr$(13)+"Welkome by NOT 3 ."+chr$(13) _ +"A game by bluatigro ."+chr$(13) _ +"Target of the game :"+chr$(13) _ +"move your X so that" +chr$(13) _ +"the computer moves "+chr$(13) _ +"the 3e in a row or colom ."+chr$(13) _ +"You begin ?";ny$ if ny$="yes" then player=human else player=comp call ai end if end sub [quit] close #m end