Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Game by Robbie
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
upthescale




PostPosted: Tue Jan 31, 2006 11:46 pm   Post subject: Game by Robbie

code:

var number, guess, chancesLeft, font, x, y, button : int
%%Variables
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Easy", 58, 220, font, red)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Medium", 260, 220, font, red)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Hard", 540, 220, font, red)
loop
    loop
        mousewhere (x, y, button)
        %Hard%
        drawfillbox (510, 200, 680, 34, 63)
        %Hard
        %Medium%
        drawfillbox (270, 200, 430, 34, 63)
        %Medium%
        %Easy%
        drawfillbox (200, 200, 34, 34, 63)
        %Easy%
        %%%%%%%Medium
        if x > 270 and x < 430 and y > 34 and y < 200 and button = 1 then
            cls
            chancesLeft := 4
            randint (number, 1, 50)
            put "Pick a number between 1-50...You have 4 chances"
            loop
                get guess
                cls
                if guess > number then
                    put "You are to high!"
                    delay (1200)
                    cls
                    chancesLeft := chancesLeft - 1
                    put "You have ", chancesLeft, " chances left"
                elsif guess < number then
                    put "You are to low!"
                    delay (1200)
                    cls
                    chancesLeft := chancesLeft - 1
                    put "You have ", chancesLeft, " chances left"
                elsif guess = number then
                    put "You are correct!"
                    delay (1200)
                    cls
                    exit
                end if
                if chancesLeft = 0 then
                    put "You have no more guesses, the number was,", number
                    delay (4300)
                    cls
                end if
                exit when chancesLeft = 0
            end loop
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Easy", 58, 220, font, red)
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Medium", 260, 220, font, red)
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Hard", 540, 220, font, red)
            %%%%%%%%Easy
        elsif x > 34 and x < 200 and y > 34 and y < 200 and button = 1 then
            cls
            chancesLeft := 4
            randint (number, 1, 20)
            put "Pick a number between 1-20...You have 4 chances"
            loop
                get guess
                cls
                if guess > number then
                    put "You are to high!"
                    delay (1200)
                    cls
                    chancesLeft := chancesLeft - 1
                    put "You have ", chancesLeft, " chances left"
                elsif guess < number then
                    put "You are to low!"
                    delay (1200)
                    cls
                    chancesLeft := chancesLeft - 1
                    put "You have ", chancesLeft, " chances left"
                elsif guess = number then
                    put "You are correct!"
                    delay (1200)
                    cls
                    exit
                end if
                if chancesLeft = 0 then
                    put "You have no more guesses, the number was, ", number
                    delay (4300)
                    cls
                end if
                exit when chancesLeft = 0
            end loop
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Easy", 58, 220, font, red)
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Medium", 260, 220, font, red)
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Hard", 540, 220, font, red)
            %%%%%%%%Hard
        elsif x > 510 and x < 680 and y > 34 and y < 200 and button = 1 then
            cls
            chancesLeft := 5
            randint (number, 1, 100)
            put "Pick a number between 1-100...You have 5 chances"
            loop
                get guess
                cls
                if guess > number then
                    put "You are to high!"
                    delay (1200)
                    cls
                    chancesLeft := chancesLeft - 1
                    put "You have ", chancesLeft, " chances left"
                elsif guess < number then
                    put "You are to low!"
                    delay (1200)
                    cls
                    chancesLeft := chancesLeft - 1
                    put "You have ", chancesLeft, " chances left"
                elsif guess = number then
                    put "You are correct!"
                    delay (1200)
                    cls
                    exit
                end if
                if chancesLeft = 0 then
                    put "You have no more guesses, the number was, ", number
                    delay (4300)
                    cls
                end if
                exit when chancesLeft = 0
            end loop
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Easy", 58, 220, font, red)
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Medium", 260, 220, font, red)
            font := Font.New ("chiller:60")
            assert font > 0
            Font.Draw ("Hard", 540, 220, font, red)
        end if
    end loop
    exit
end loop
%By Robbie Comeau
%circa_appleyard707@hotmail.com


[mod:b02e45966c="Delos"]
In the future, please use [code] tags.
[/mod:b02e45966c]
Sponsor
Sponsor
Sponsor
sponsor
upthescale




PostPosted: Wed Feb 01, 2006 9:33 pm   Post subject: (No subject)

whats a code tag?
[Gandalf]




PostPosted: Thu Feb 02, 2006 7:55 pm   Post subject: (No subject)

They format the code you post so that it is more readable without copying it into your editor (Turing). Type [code] right before your code, and [/code] at the end of your code. Also, read the rules/stickies.
sylvester-27




PostPosted: Fri Feb 03, 2006 8:57 am   Post subject: (No subject)

this might just be because of Turing 4.1, but when the game starts up, the 'hard' button is only half on the screen. Might wanna fix that. Anyway, good game.
batman




PostPosted: Thu Mar 02, 2006 9:40 pm   Post subject: Game

I really like that fact that before a person starts the game they click on the box on which level of difficulty they want to play. Very Happy
Delos




PostPosted: Thu Mar 02, 2006 9:43 pm   Post subject: (No subject)

batman, see post in Tic-tac-toe thread regarding necroposting.
batman




PostPosted: Thu Mar 02, 2006 9:55 pm   Post subject: Game

I already saw the tic tac toe post. I won't reply to anymore old programs.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: