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

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




PostPosted: Tue May 03, 2005 2:18 pm   Post subject: Guessing Game

This is a betting game i made in my spare time.


% By Dann Westman
% April 28 2005
%This is a betting game

var font, font2 :int
font := Font.New ("Arial:20:Bold")
font2 := Font.New ("Arial:130:Bold")
var name : string
var point:int
var guess:int
var answer:int
var bet:int
var bob:string
answer:=Rand.Int(1,3)

%Colours
setscreen ("graphics:500,500")
colourback (black)
colour (yellow)
cls

%Title page and Info
for a : 1 .. 500
Draw.FillBox (0, 0, a, 50, green)
Draw.FillBox (0, 500, a, 450, green)
Draw.FillBox (500, 0, 450, a, green)
Draw.FillBox (0, 0, 50, a, green)
Font.Draw ("Westman Programs Presents", 60, 250, font, yellow)
delay (5)
end for
delay (1000)
cls
for b : 1 .. 101
Font.Draw ("Guessing Games", 120, 250, font, b)
delay (20)
end for
delay (1000)
cls
loop
put "Enter name here:" ..
get name
cls
put "How many points will you start with between 1-10, get to 100 and win?:" ..

get point
cls
loop
put"Player:",name,""
put"Points:",point,""

Draw.FillBox (50, 50, 200, 200, brown)
Draw.FillBox (250, 50, 400, 200, brown)
Draw.FillBox (150, 210, 300, 360, brown)
Font.Draw("1",75,60,font2,red)
Font.Draw("2",175,220,font2,green)
Font.Draw("3",275,60,font2,yellow)
Draw.Line(0,450,500,450,yellow)
delay(4000)
cls
put"Place a bet:"..
get bet
cls
put"Pick a box. 1,2,or 3:"..
get guess
if guess=answer then
put"Yes. That's the one!"
else
put"No. Wrong box."
end if
if guess=answer then
point:=bet+point
else
point:=point-bet
end if
delay(1000)
cls
exit when(point>=100)
exit when(point<=0)
cls
end loop
if point>=100 then
put"You Win!!!"
else
put"You are out of points. You lose!"
end if
put"Do you want to play again?(y) or (n)"
get bob
cls
exit when(bob="n")
end loop
put"program finished.."
[/code] Twisted Evil Twisted Evil
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Tue May 03, 2005 3:19 pm   Post subject: (No subject)

First off, you forgot the beginning code tag Smile.

Second off - every time the answer is 3, or whatever the first random number is. You might want to put that in a loop too so that it differs every time!
dann_west




PostPosted: Tue May 03, 2005 6:57 pm   Post subject: (No subject)

[thx 4 the idea.
It isnt quite done yet.
neufelni




PostPosted: Fri May 27, 2005 11:26 am   Post subject: (No subject)

I played the game and every time the number was 1.
RaPsCaLLioN




PostPosted: Fri May 27, 2005 1:38 pm   Post subject: (No subject)

Yea. The number was 2 every time for me. And... I told it I wanted 1 point, then I bet 100, then I won. Smile
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  [ 5 Posts ]
Jump to:   


Style:  
Search: