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

Username:   Password: 
 RegisterRegister   
 New and improved 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: Wed Feb 01, 2006 1:00 am   Post subject: New and improved game by Robbie

%A program that has 4 levels: easy, medium, hard and insane. The user is able
%to click on their skilled level, and then play that level. The level's are
%asking the user to pick a number between what ever number's the level tell you.
%The users goal is to try and guess the number. If the user's guess is to high,
%the program will say, 'Too High.' Or if the user's guess is to low, the program
%will simply say, 'Too Low.' The user has an amount of guesses at each level,
%depending on how big the range of numbers are, ranging from 1-50, all the way up to
%1-1000 which is the insane mode. After each level, the program will loop itself
%and bring the user to the main screen, back to where they started%
colorback (7)
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
colorback (84)
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
put ""
colorback (154)
var answer : string
var number, guess, chancesLeft, font, x, y, button : int
var ch : string (1)
%%Variables
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Easy", 58, 220, font, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Medium", 260, 220, font, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Hard", 540, 220, font, 54)
font := Font.New ("chiller:40")
assert font > 0
Font.Draw ("Insane", 300, 355, font, 54)


loop
loop

mousewhere (x, y, button)
%Insane
drawfillbox (228, 350, 466, 304, 63)
%Insane
%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)
color (87)
put "Pick a number between 1-50...You have 4 chances"
loop
get guess
cls
if guess > number then
color (87)
put "You are to high!"
delay (1200)
cls
chancesLeft := chancesLeft - 1
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess < number then
color (87)
put "You are to low!"
delay (1200)
cls
chancesLeft := chancesLeft - 1
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess = number then
color (87)
put "You are correct!"
delay (1200)
cls
exit
end if
if chancesLeft = 0 then
color (87)
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, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Medium", 260, 220, font, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Hard", 540, 220, font, 54)
font := Font.New ("chiller:40")
assert font > 0
Font.Draw ("Insane", 300, 355, font, 54)
%%%%%%%%Easy
elsif x > 34 and x < 200 and y > 34 and y < 200 and button = 1 then
cls
chancesLeft := 4
randint (number, 1, 20)
color (87)
put "Pick a number between 1-20...You have 4 chances"
loop
get guess
cls
if guess > number then
color (87)
put "You are to high!"
delay (1200)
cls
chancesLeft := chancesLeft - 1
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess < number then
color (87)
put "You are to low!"
delay (1200)
cls
chancesLeft := chancesLeft - 1
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess = number then
color (87)
put "You are correct!"
delay (1200)
cls
exit
end if
if chancesLeft = 0 then
color (87)
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, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Medium", 260, 220, font, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Hard", 540, 220, font, 54)
font := Font.New ("chiller:40")
assert font > 0
Font.Draw ("Insane", 300, 355, font, 54)
%%%%%%%%Hard
elsif x > 510 and x < 680 and y > 34 and y < 200 and button = 1 then
cls
chancesLeft := 5
randint (number, 1, 100)
color (87)
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
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess < number then
color (87)
put "You are to low!"
delay (1200)
cls
chancesLeft := chancesLeft - 1
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess = number then
color (87)
put "You are correct!"
delay (1200)
cls
exit
end if
if chancesLeft = 0 then
color (87)
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, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Medium", 260, 220, font, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Hard", 540, 220, font, 54)
font := Font.New ("chiller:40")
assert font > 0
Font.Draw ("Insane", 300, 355, font, 54)
%%%%%%%%Insane
elsif x > 228 and x < 466 and y > 304 and y < 350 and button = 1 then
cls
chancesLeft := 7
randint (number, 1, 1000)
color (87)
put "You have entered the insane mode! (Hit a key to continue)"
getch (ch)
cls
color (87)
put "You can always turn back by hitting the q on your keyboard for Quit! (Hit a key to continue)"
getch (ch)
cls
color (87)
put "What will it be?"
put ""
put ""
color (87)
put "Quit- q"
color (87)
put "Continue- type in Enter"
get answer
cls
if answer = "q" or answer = "Q" then
color (87)
put "I thought so!"
delay (1000)
break
else
end if
color (87)
put "Pick a number between 1-1000...You have 7 chances"
loop
get guess
cls
if guess > number then
color (87)
put "You are to high!"
delay (1200)
cls
chancesLeft := chancesLeft - 1
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess < number then
color (87)
put "You are to low!"
delay (1200)
cls
chancesLeft := chancesLeft - 1
color (87)
put "You have ", chancesLeft, " chances left"
elsif guess = number then
color (87)
put "Amazingly done!!"
delay (1200)
cls
exit
end if
if chancesLeft = 0 then
color (87)
put "You have no more guesses, the number was, ", number
delay (4300)
cls
color (87)
put "Never will you beat the insane mode!"
delay (3300)
cls
end if
exit when chancesLeft = 0
end loop
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Easy", 58, 220, font, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Medium", 260, 220, font, 54)
font := Font.New ("chiller:60")
assert font > 0
Font.Draw ("Hard", 540, 220, font, 54)
font := Font.New ("chiller:40")
assert font > 0
Font.Draw ("Insane", 300, 355, font, 45)
end if
end loop
exit
end loop
%By Robbie Comeau
%circa_appleyard707@hotmail.com
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: