Jump to content

Recommended Posts

Posted (edited)

Hallo everybody, i maded this little game because i have been bored :(

Not much to say, just enter number between 1 and 1000 and hit ENTER or click on "Try" button ...and find out what's mysterious number :)

(click on "reset" button for new game with a new mysterious number)

Source is attached below.

btw, my personal record is 6 :D

n3_Number_Hide_.au3

Down is fixed version: click

Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Posted

umm... this is really basic.

Maybe you missed made in 10 minutes or whatever it was and reading his post i think it was supposed to be basic...

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Posted

Thanks for the game. Here's one for you.

#include <GUIConstants.au3>

GUICreate("Number Game", 200, 100)

GUICtrlCreateLabel("Guess a number between 1 and 10.", 10, 10)

$nInput = GUICtrlCreateInput("", 10, 50)

GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $nInput
            $n = Number(GUICtrlRead($nInput))
            While 1
                $i = Random(1,10,1)
                If $i <> $n Then
                    MsgBox(0, "Number Game", "WRONG!!! The number was " & $i & @CRLF & @CRLF & "Keep trying!")
                    ExitLoop
                EndIf
            WEnd
    EndSwitch
WEnd
Posted (edited)

I noticed your "Try" does not reset when I click Reset.

The "Record" is broken. Because I had a record of 3, which was reset to 8 later.

$iLow = 1
$iMax = 1000

While 1
    $iGuess = Round(($iLow+$iMax)/2)
    ControlSetText("n3 Number Hide", "", "Edit1", $iGuess)
    ControlClick("n3 Number Hide", "", "Button2")
    
    Sleep(100) ;; Aww too eeet be slow
    $sRead = ControlGetText("n3 Number Hide", "", "Static3")
    
    ;ConsoleWrite("iMax = " & $iMax & @CRLF & "iLow = " & $iLow & @CRLF & "iGuess = "& $iGuess & @CRLF & "sRead = " & $sRead & @CRLF & @CRLF) ;; Use this if you want to see what's going on
    If StringInStr($sRead,"bigger than") Then
        $iLow = $iGuess
    Else
        $iMax = $iGuess
    EndIf
    
    If StringInStr($sRead, "Congratulations") Then
        $iLow = 1
        $iMax = 1000
        ControlClick("n3 Number Hide", "", "Button1")
        Sleep(100)
    EndIf
WEnd
Edited by Manadar
Posted

oh sorry, i missed that.. here is fixed version attached below :)

Now works without bugs, i think :(

n3_Number_Hide_.au3

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...