本帖最后由 tryhi 于 2012-8-4 17:14 编辑
用反编译你的时间还不如自己写一个
GUICreate("Form1", 540, 427, 192, 124)
$Input1 = GUICtrlCreateInput("", 169, 42, 138, 21,8192)
GUICtrlCreateLabel("输入不重复的四位数字", 33, 47, 124, 17)
$Button1 = GUICtrlCreateButton("开猜", 350, 39, 75, 25)
$Button2 = GUICtrlCreateButton("生成随机数", 353, 80, 75, 25)
GUISetState()
GUICtrlSetState($Button1,128)
Global $suiji,$cishu = 1
Global $Label[8]
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Button2
Global $string = '0123456789'
$suiji = ''
For $i =10 To 7 Step -1
$ss = StringMid($string,Random(1,$i,1),1)
$string = StringReplace($string,$ss,'')
$suiji &= $ss
Next
GUICtrlSetState($Button2,128)
GUICtrlSetState($Button1,64)
Case $Button1
$tian = GUICtrlRead($Input1)
$tians = StringSplit($tian,'')
If $tians[0] <> 4 Then
MsgBox(0,0,'请输入4位数字')
ContinueCase
EndIf
If StringRegExp($tian,'(.).*\1') Then
MsgBox(0,0,'请输入不重复的数字')
ContinueCase
EndIf
$suijis = StringSplit($suiji,'')
Local $n = 0,$m = 0
For $i = 1 To 4
If StringInStr($suiji,$tians[$i]) Then $n+=1
If $tians[$i] = $suijis[$i] Then $m+=1
Next
If $m = 4 Then
cls('成功','答案正确')
ContinueCase
EndIf
$Label[$cishu-1] = GUICtrlCreateLabel("第"&$cishu&"次:"&$m&"个位置数字都正确,"&$n-$m&"个数字正确位置不对 ("&$tian&")", 34, 133+($cishu-1)*20, 402, 17)
$cishu += 1
If $cishu = 9 Then cls('游戏结束','正确答案:'&$suiji)
EndSwitch
WEnd
Func cls($ti,$te)
MsgBox(0,$ti,$te)
Global $cishu = 1
For $i = 0 To 7
GUICtrlDelete($Label[$i])
Next
GUICtrlSetState($Button2,64)
GUICtrlSetState($Button1,128)
EndFunc
|