colorback (black)
cls
var reply : string (1) %variable to use with getch command
var answer : int %the answer that the user inputs
var right_answer : int %the right answer
var restart : string %choice if the user wants to restart
var choicea, choiceb, choicec, choiced, question : string %options when choosing rght answer
var elim1, elim2 : int %the two options that get eliminated in the lifeline 50/50
var value, valran : int% value of the question
%the intro
color (white)
locate (11, 27)
put "Welcome to the Gameshow:"
locate (12, 25)
put "WHO WANTS TO BE A MILLIONAIRE!"
locate (25, 1)
put "Press any key to Start Game:" ..
getch (reply)
procedure fiftyfifty %50/50 lifeline
loop
randint (elim1, 1, 4)
randint (elim2, 1, 4)
if elim1 = right_answer or elim2 = right_answer then
put ""
elsif elim1 = elim2 then
put ""
else
exit
end if
end loop
if elim1 = 1 or elim2 = 1 then
drawfillbox (1, 50, maxx div 2, 100, black)
elsif elim1 = 2 or elim2 = 2 then
drawfillbox (maxx div 2, 50, maxx, 100, black) %second question
elsif elim1 = 3 or elim2 = 3 then
drawfillbox (1, 1, maxx div 2, 50, black) %third question
elsif elim1 = 4 or elim2 = 4 then
drawfillbox (maxx div 2, 1, maxx, 50, black) %fourth
end if
get answer
end fiftyfifty
procedure phone %phonecall lifeline
locate (4, 1)
put "Freind: Hi" ..
locate (5, 1)
put "You: *Tells question to friend*" ..
locate (6, 1)
randint (valran, 1, 20)
if valran <= value then
put "Freind:I am really not sure, sorry!" ..
else
put "Freind: I think the answer ", right_answer ..
end if
get answer
end phone
procedure right %procedure it goes through to check if answer is correct
locate (2, 1)
if answer = right_answer then
locate (8, 1)
put "YOU ARE RIGHT!!!" ..
locate (9, 1)
put "Press any key to go to next question" ..
getch (reply)
else
locate (8, 1)
put "Wrong, you lose the game" ..
getch (reply)
end if
end right
procedure format %the game format or where everything is placed
drawbox (1, 1, maxx, 100, white) % options box
drawline (maxx div 2, 1, maxx div 2, 100, white)
drawline (1, 50, maxx, 50, white)
drawline (1, 180, maxx, 180, white) %box in question
drawline (maxx div 2, 180, maxx div 2, maxy, white) % vertical line
locate (1, 55)
put "INSTRUCTIONS"
locate (2, 42)
put "-Select 1,2,3 or 4 as your answer"
locate (3, 42)
put "-Typing 5,6 or 7 will bring lifelines"
locate (4, 42)
put "-5 gives the fifty-fifty lifeline"
locate (5, 42)
put "-6 gives the phonecall lifeline."
locate (6, 42)
put "-7 lets you ask the audience."
%where the choices are places
locate (15, 2)
put question ..
locate (21, 2)
put choicea ..
locate (21, 42)
put choiceb ..
locate (24, 2)
put choicec ..
locate (24, 42)
put choiced ..
locate (18, 2)
put "What will you choose?" ..
get answer
if answer = 5 then%lifelines
fiftyfifty
elsif answer = 6 then
phone
end if
right
end format
%%%%%The next series of procedures are just the questions themself
procedure onehundred %$100 question
cls
value := 1
put "For $100:"
put ""
question := "What is the Capital of Canada?"
choicea := "1)Quebec"
choiceb := "2)Ontario"
choicec := "3)Ottawa"
choiced := "4)Toronto"
right_answer := 3
format
end onehundred
procedure twohundred %$200 question
cls
value := 2
put "For $200:"
put ""
question := "What are the three forms of matter?"
choicea := "1)Solid, Liquid and Gas"
choiceb := "2)Solid, Liquid and Air"
choicec := "3)Ice, Water and Steam"
choiced := "4)Solid, Liquid and plasma"
right_answer := 1
format
end twohundred
onehundred
twohundred
|