Jump to content
Sign in to follow this  
Hok

Guess My Number Game

Recommended Posts

Hok

Hey everyone. This is my first contribution, but it isn't very useful. It is a simple GuessMyNumber game where you guess a number between 1 and 100. Check it out and please give me feedback.

:) Hok :(

GuessMyNumberGUI.au3

Share this post


Link to post
Share on other sites
TnTProductions

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"

Share this post


Link to post
Share on other sites
d4rk

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

Share this post


Link to post
Share on other sites
i542

3 tries for 89.


I can do signature me.

Share this post


Link to post
Share on other sites
i542

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.

Share this post


Link to post
Share on other sites
Hok

I'm seeing a lot of...

I got ___ tries for ___. Any better way I could've written the code?

Share this post


Link to post
Share on other sites
Vossen

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

Share this post


Link to post
Share on other sites
Gillboss

5 tries xD

i have secret technique, i cant public it :)

Share this post


Link to post
Share on other sites
AlmarM

Nice! You got it! It took you 1 tries! You are OK... It was 5 >.<

Nice program :)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
ACS

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. :(

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.