#include #include Global $ff = GUICreate("XO", 300, 300) GUISetIcon(@SystemDir & "\mspaint.exe", 0) Start() Func Start() Global $11 = GUICtrlCreateButton( "", 50, 50, 40 , 40) Global $12 = GUICtrlCreateButton( "", 110, 50, 40 , 40) Global $13 = GUICtrlCreateButton( "", 170, 50, 40 , 40) Global $21 = GUICtrlCreateButton( "", 50, 100, 40 , 40) Global $22 = GUICtrlCreateButton( "", 110, 100, 40 , 40) Global $23 = GUICtrlCreateButton( "", 170, 100, 40 , 40) Global $31 = GUICtrlCreateButton( "", 50, 150, 40 , 40) Global $32 = GUICtrlCreateButton( "", 110, 150, 40 , 40) Global $33 = GUICtrlCreateButton( "", 170, 150, 40 , 40) Global $35 = GUICtrlCreateButton( "", 1, 1, 1 , 1) Global $Exit = GUICtrlCreateButton( "Exit", 250, 250, 40 , 40) Global $reset = GUICtrlCreateButton( "Reset", 200, 250, 40 , 40) Global $Turn = GUICtrlCreateLabel( " Turn : ", 220, 200) Global $XO = GUICtrlCreateLabel( "X", 260, 200) GUISetState(@SW_SHOW) EndFunc Global $x11=1,$x12=1,$x13=1,$x21=1,$x22=1,$x23=1,$x31=1,$x32=1,$x33=1 Global $111=1 ,$122=1,$133=1,$211=1,$222=1,$233=1,$311=1,$322=1,$333=1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE , $Exit Exit 0 Case $11 GUICtrlSetStyle($11,0x08000000) Global $111 = "Disabled" Global $x11 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($11,$x11) Win(11) Chk() Case $12 GUICtrlSetStyle($12,0x08000000) Global $122 = "Disabled" Global $x12 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($12,$x12) Win(12) Chk() Case $13 GUICtrlSetStyle($13,0x08000000) Global $133 = "Disabled" Global $x13 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($13,$x13) Win(13) Chk() Case $21 GUICtrlSetStyle($21,0x08000000) Global $211 = "Disabled" Global $x21 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($21,$x21) Win(21) Chk() Case $22 GUICtrlSetStyle($22,0x08000000) Global $222 = "Disabled" Global $x22 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($22,$x22) Win(22) Chk() Case $23 GUICtrlSetStyle($23,0x08000000) Global $233 = "Disabled" Global $x23 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($23,$x23) Win(23) Chk() Case $31 GUICtrlSetStyle($31,0x08000000) Global $311 = "Disabled" Global $x31 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($31,$x31) Win(31) Chk() Case $32 GUICtrlSetStyle($32,0x08000000) Global $322 = "Disabled" Global $x32 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($32,$x32) Win(32) Chk() Case $33 GUICtrlSetStyle($33,0x08000000) Global $333 = "Disabled" Global $x33 = ControlGetText("","","[CLASS:Static; INSTANCE:2]") GUICtrlSetData($33,$x33) Win(33) Chk() Case $reset Reset(2) EndSwitch WEnd Func Chk() _GUICtrlButton_SetFocus($35) Global $WWw = ControlGetText("","","[CLASS:Static; INSTANCE:2]") If $WWw = "X" Then ControlSetText ( "", "", $XO , "O" ) Else ControlSetText ( "", "", $XO , "X" ) EndIf Reset(1) EndFunc Func Reset($s) If $s = 1 Then If $111 = "Disabled" And $122 = "Disabled" And $133 = "Disabled" And $211 = "Disabled" And $222 = "Disabled" And $233 = "Disabled" And $311 = "Disabled" And $322 = "Disabled" And $333 = "Disabled" Then MsgBox(64,"Draw", "Round Draw") Done() Global $x11=1,$x12=1,$x13=1,$x21=1,$x22=1,$x23=1,$x31=1,$x32=1,$x33=1 Global $111=1 ,$122=1,$133=1,$211=1,$222=1,$233=1,$311 =1,$322 =1,$333 = 1 EndIf Else Done() Global $x11=1,$x12=1,$x13=1,$x21=1,$x22=1,$x23=1,$x31=1,$x32=1,$x33=1 Global $111=1 ,$122=1,$133=1,$211=1,$222=1,$233=1,$311 =1,$322 =1,$333 = 1 EndIf EndFunc Func Win($btn) Local $owner = ControlGetText("","","[CLASS:Static; INSTANCE:2]") If $btn = 11 Or $btn = 12 Or $btn = 13 Then If $x11 = $owner And $x12 = $owner And $x13 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf If $btn = 11 Or $btn = 21 Or $btn = 31 Then If $x11 = $owner And $x21 = $owner And $x31 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf If $btn = 11 Or $btn = 22 Or $btn = 33 Then If $x11 = $owner And $x22 = $owner And $x33 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf If $btn = 13 Or $btn = 23 Or $btn = 33 Then If $x13 = $owner And $x23 = $owner And $x33 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf If $btn = 12 Or $btn = 22 Or $btn = 32 Then If $x12 = $owner And $x22 = $owner And $x32 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf If $btn = 13 Or $btn = 22 Or $btn = 31 Then ; 13 , 22 , 31 If $x13 = $owner And $x22 = $owner And $x31 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf If $btn = 21 Or $btn = 22 Or $btn = 23 Then ; 21 , 22 , 23 If $x21 = $owner And $x22 = $owner And $x23 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf If $btn = 31 Or $btn = 32 Or $btn = 33 Then ; 31 , 32 , 33 If $x31 = $owner And $x32 = $owner And $x33 = $owner Then MsgBox(64,"Victory", $owner & " Victory") Done() EndIf EndIf EndFunc Func Done() GUICtrlSetStyle($11,64) GUICtrlSetStyle($12,64) GUICtrlSetStyle($13,64) GUICtrlSetStyle($21,64) GUICtrlSetStyle($22,64) GUICtrlSetStyle($23,64) GUICtrlSetStyle($31,64) GUICtrlSetStyle($32,64) GUICtrlSetStyle($33,64) GUICtrlSetData($11,"") GUICtrlSetData($12,"") GUICtrlSetData($13,"") GUICtrlSetData($21,"") GUICtrlSetData($22,"") GUICtrlSetData($23,"") GUICtrlSetData($31,"") GUICtrlSetData($32,"") GUICtrlSetData($33,"") Global $x11=1,$x12=1,$x13=1,$x21=1,$x22=1,$x23=1,$x31=1,$x32=1,$x33=1 Global $111=1 ,$122=1,$133=1,$211=1,$222=1,$233=1,$311 =1,$322 =1,$333 = 1 EndFunc