Jump to content

Guess My Number Game


Hok
 Share

Recommended Posts

cool for a newbage :)

agreed

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

8 tries for "21", I'm OK

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Func Test()
$Guess=GUICtrlRead($input1)
If ($guess > $Random) then
        $Label2 = GUICtrlCreateLabel("Status: Checking...", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        Sleep(Random(500, 1000))
        $Label2 = GUICtrlCreateLabel("Status: The Number is Lower!", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        $Counter=$Counter+1
    EndIf
If ($guess < $Random) then
    $Label2 = GUICtrlCreateLabel("Status: Checking...", 8, 168, 376, 48)
    GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        Sleep(Random(500, 1000))
        $Label2 = GUICtrlCreateLabel("Status: The Number is Higher!", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        $Counter=$Counter+1
        EndIf
    If ($guess == $Random) then
        $Label2 = GUICtrlCreateLabel("Status: Checking...", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        Sleep(Random(500, 1000))
        If $Counter<5 Then
            $Phrase=" You are pro!"
        EndIf
        If $Counter >= 5 Then
            $Phrase=" You are OK..."
        EndIf
        If $Counter>10 Then
            $Phrase=" You are awful!"
        EndIf
        
        $Label2 = GUICtrlCreateLabel("Nice! You got it! It took you " &$Counter &" tries!" &$Phrase, 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        $Counter=$Counter+1
        Sleep(2000)
    EndIf
EndFunc
Now it can say "You're a pro"

Edited by i542

I can do signature me.

Link to comment
Share on other sites

Func Test()
    $Guess = GUICtrlRead($Input1)
    If $Guess > 100 or $Guess < 1 Then
        MsgBox(64,"Guess invalid","The guess has to be a number from 1 to 100. " & $Guess & " is not within that range.")
    Else
    If ($Guess > $Random) Then
        $Label2 = GUICtrlCreateLabel("Status: Checking...", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        Sleep(Random(500, 1000))
        $Label2 = GUICtrlCreateLabel("Status: The Number is Lower!", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        $Counter = $Counter + 1
    EndIf
    If ($Guess < $Random) Then
        $Label2 = GUICtrlCreateLabel("Status: Checking...", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        Sleep(Random(500, 1000))
        $Label2 = GUICtrlCreateLabel("Status: The Number is Higher!", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        $Counter = $Counter + 1
    EndIf
    If ($Guess == $Random) Then
        $Label2 = GUICtrlCreateLabel("Status: Checking...", 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        Sleep(Random(500, 1000))
        If $Counter < 5 Then
            $Phrase = " You are pro!"
        EndIf
        If $Counter < 10 Then
            $Phrase = " You are OK..."
        EndIf
        If $Counter > 10 Then
            $Phrase = " You are awful!"
        EndIf
        
        $Label2 = GUICtrlCreateLabel("Nice! You got it! It took you " & $Counter & " tries!" & $Phrase, 8, 168, 376, 48)
        GUICtrlSetFont(-1, 15, 800, 0, "Toxica")
        $Counter = $Counter + 1
        Sleep(2000)
    EndIf
    EndIf
EndFunc

Now it will give an error if the guess in invalid. :)

Edited by Vossen
Link to comment
Share on other sites

Nice first shot for a program. :)

I have a few suggestion to make it a bit more user-friendly.

After a guess, the program should clear the input field so the user can just type another guess. Of course the message should report the guessed number, i.e. "The number is higher than (guess)!"

After the user correctly guesses the number, the "Guess" button should reset the game so the user can play again. For example, the button text can change to "New game" or something similar, and when the user clicks it the button reverts back to its original "Guess" state and the status message informs the user its ready for a new guess.

On that same note, when the program first starts up the status message should say it's waiting for the user to make a guess.

Just some suggestions from a GUI nazi. :(

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...