#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Dim $a=10,$b=99
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("电脑猜数", 461, 185, 243, 199, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Label1 = GUICtrlCreateLabel("电脑猜的数:", 40, 24, 123, 20)
$Label2 = GUICtrlCreateLabel("猜的对吗?", 248, 24, 131, 20)
$Radio1 = GUICtrlCreateRadio("小", 256, 56, 113, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, "Radio1Click")
$Radio2 = GUICtrlCreateRadio("对", 256, 80, 113, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, "Radio2Click")
$Radio3 = GUICtrlCreateRadio("大", 256, 104, 113, 17)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, "Radio3Click")
$Button1 = GUICtrlCreateButton("开始", 376, 120, 73, 49)
GUICtrlSetOnEvent(-1, "Button1Click")
$Label3 = GUICtrlCreateLabel("", 64, 64, 64, 64)
GUICtrlSetFont(-1, 36, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xFF0000)
$Label4 = GUICtrlCreateLabel("你想的数是:", 352, 24, 67, 20)
GUICtrlSetState(-1,$gui_hide)
$Label5 = GUICtrlCreateLabel("", 383, 50, 64, 64)
GUICtrlSetState(-1,$gui_hide)
GUICtrlSetFont(-1, 36, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Button1Click()
GUICtrlSetState($Radio1,$gui_enable)
GUICtrlSetState($Radio2,$gui_enable)
GUICtrlSetState($Radio3,$gui_enable)
GUICtrlSetData($Label3,Random($a,$b,1))
GUICtrlSetState($Button1,$gui_disable)
GUICtrlSetState($Label5,$gui_hide)
GUICtrlSetState($Label4,$gui_hide)
EndFunc
Func Form1Close()
Exit
EndFunc
Func Radio1Click()
$a=GUICtrlRead($Label3)
GUICtrlSetData($label3,Round(($b+$a)/2,0))
EndFunc
Func Radio2Click()
GUICtrlSetState($Label5,$gui_show)
GUICtrlSetState($Label4,$gui_show)
GUICtrlSetData($Label5,GUICtrlRead($Label3))
GUICtrlSetState($Button1,$gui_enable)
GUICtrlSetData($Button1,'再来一次')
$a=10
$b=99
GUICtrlSetState($Radio1,$gui_disable)
GUICtrlSetState($Radio2,$gui_disable)
GUICtrlSetState($Radio3,$gui_disable)
GUICtrlSetState($Radio1,$GUI_UNCHECKED)
GUICtrlSetState($Radio2,$GUI_UNCHECKED)
GUICtrlSetState($Radio3,$GUI_UNCHECKED)
GUICtrlSetData($Label3,'')
EndFunc
Func Radio3Click()
$b=GUICtrlRead($Label3)
GUICtrlSetData($label3,Round(($b+$a)/2,0))
EndFunc