Computer Science Canada

millionaire-isu, can u help ??

Author:  spike0721 [ Mon Jun 09, 2008 8:49 pm ]
Post subject:  millionaire-isu, can u help ??

i have till friday to have this done, and some of my things are just not working for me.
if you could help, that would be great.
thanks <3 Very Happy


Turing:



import GUI

%BY- Jessica Toll

%ISU-Who Wants to be a Millionaire?

%To- Mr. R Swayze

%Class- TIK 20




colorback (black)

cls

%the var statements

var reply : string (1)

var answer : int

var right_answer, P, R, q, W, SSN : int

var restart : string

var choicea, choiceb, choicec, choiced, question : string

var elim1, elim2 : int

var value, valran : int

var name : string

var incorrect, correct : int

var B1, B2, B3, B4, font1 : int

var Q, Phone, fifty : int

font1 := Font.New ("Comic Sans MS:10")




incorrect := 0

correct := 0













%50/50 lifeline

colorback (black)

cls

procedure fiftyfifty




end fiftyfifty




%phonecall lifeline

procedure phone

locate (4, 1)

put "Freind: Hi" ..

locate (5, 1)

put "You: *Tells question to friend*" ..

locate (6, 1)




randint (valran, 1, 2)

if valran <= value then

put "Freind:", name, "I am really not sure, sorry!" ..

else

put "Freind: I think the answer ", right_answer

put ""

locate (10, 20)

put "Now What Do You Think The Answer Is??"

end if







end phone




%seeing if the answer is correct

procedure right

locate (2, 1)

if answer = right_answer then

locate (8, 1)

put name, "" : 1, "YOU ARE RIGHT!!!" ..

locate (9, 1)

put "Press any key to go to next question" ..

getch (reply)

else

locate (8, 1)

put "Wrong,Sorry", name, "you lose" ..

getch (reply)

end if

end right







%Boxes and how the game is planned out

procedure format




drawbox (1, 1, maxx, 100, white)

drawline (maxx div 2, 1, maxx div 2, 100, white)

drawline (1, 50, maxx, 50, white)




drawline (1, 180, maxx, 180, white)




drawline (maxx div 2, 180, maxx div 2, maxy, white)




color (36)

locate (1, 55)

put "INSTRUCTIONS"

locate (2, 42)

put "-Select 1,2,3 or 4 as your answer"

locate (3, 42)

put "-you can only use the life line once"

locate (4, 42)

put "-5 gives the fifty-fifty lifeline"

locate (5, 42)

put "-6 gives the phonecall lifeline."




color (54)

%where the choices are placed

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

color (green)

locate (18, 2)

put "What Do You Think The Answer Is ???" ..

get answer

if answer = 5 then %lifelines

fiftyfifty

elsif answer = 6 then

phone

end if

right




end format




cls







%question 7 for $8 000

proc q7right

correct += 1




end q7right




proc q7wrong


cls

drawfillbox (50, 50, 500, 350, 54)

locatexy (70, 350)

color (57)

put "Name:", "" : 7, name

locatexy (60, 335)

put "amount:", "" : 7, "dollars", value

locatexy (60, 300)

put "Social Securiy Number:", "" : 7, SSN

locatexy (50, 60)

put "This Check Is Not Real, I Will Not Be Giving You Money"

GUI.Quit

end q7wrong




proc Q7

GUI.Dispose (B1)

GUI.Dispose (B2)

GUI.Dispose (B3)

GUI.Dispose (B4)

cls




Font.Draw ("$8,000 question", 10, 375, font1, blue)

Font.Draw ("Who Is The Creater of harry pottor?", 10, 300, font1, green)

value := 1000







B1 := GUI.CreateButton (100, 200, 0, "Harry Potter", q7wrong)

B2 := GUI.CreateButton (100, 150, 0, "Terry Goodkind", q7wrong)

B3 := GUI.CreateButton (100, 100, 0, "J.K. Rowling", q7right)

B4 := GUI.CreateButton (100, 50, 0, "George Lucas", q7wrong)

fifty := GUI.CreateButton (300, 200, 0, "Fifty-fifty", fiftyfifty)

Phone := GUI.CreateButton (300, 150, 0, "phone a friend", phone)

W := GUI.CreateButton (300, 100, 0, "Walk Away ", GUI.Quit)

var Q : int := GUI.CreateButton (10, 10, 0, "Quit", GUI.Quit)

end Q7







%question 6 for $4 000

proc q6right

correct += 1




end q6right




proc q6wrong


cls

drawfillbox (50, 50, 500, 350, 54)

locatexy (70, 350)

color (57)

put "Name:", "" : 7, name

locatexy (60, 335)

put "amount:", "" : 7, "dollars", value

locatexy (60, 300)

put "Social Securiy Number:", "" : 7, SSN

locatexy (50, 60)

put "This Check Is Not Real, I Will Not Be Giving You Money"

GUI.Quit

end q6wrong




proc Q6

GUI.Dispose (B1)

GUI.Dispose (B2)

GUI.Dispose (B3)

GUI.Dispose (B4)

cls




Font.Draw ("$4,000 question", 10, 375, font1, blue)

Font.Draw ("How Many Questions Have You Answered??", 10, 300, font1, green)

value := 1000







B1 := GUI.CreateButton (100, 200, 0, "5", q6right)

B2 := GUI.CreateButton (100, 150, 0, "3", q6wrong)

B3 := GUI.CreateButton (100, 100, 0, "7", q6wrong)

B4 := GUI.CreateButton (100, 50, 0, "4", q6wrong)

fifty := GUI.CreateButton (300, 200, 0, "Fifty-fifty", fiftyfifty)

Phone := GUI.CreateButton (300, 150, 0, "phone a friend", phone)

W := GUI.CreateButton (300, 100, 0, "Walk Away ", GUI.Quit)

var Q : int := GUI.CreateButton (10, 10, 0, "Quit", GUI.Quit)

end Q6













%question 5 for $2000

proc q5right

correct += 1




end q5right




proc q5wrong


cls

drawfillbox (50, 50, 500, 350, 54)

locatexy (70, 350)

color (57)

put "Name:", "" : 7, name

locatexy (60, 335)

put "amount:", "" : 7, "dollars", value

locatexy (60, 300)

put "Social Securiy Number:", "" : 7, SSN

locatexy (50, 60)

put "This Check Is Not Real, I Will Not Be Giving You Money"

GUI.Quit

end q5wrong




proc Q5

GUI.Dispose (B1)

GUI.Dispose (B2)

GUI.Dispose (B3)

GUI.Dispose (B4)

cls




Font.Draw ("$2,000 question", 10, 375, font1, blue)

Font.Draw ("What Day Do We Start Exams??", 10, 300, font1, green)

value := 1000







B1 := GUI.CreateButton (100, 200, 0, "monday ", q5wrong)

B2 := GUI.CreateButton (100, 150, 0, "friday", q5wrong)

B3 := GUI.CreateButton (100, 100, 0, "tuesday", q5right)

B4 := GUI.CreateButton (100, 50, 0, "staurday", q5wrong)

fifty := GUI.CreateButton (300, 200, 0, "Fifty-fifty", fiftyfifty)

Phone := GUI.CreateButton (300, 150, 0, "phone a friend", phone)

W := GUI.CreateButton (300, 100, 0, "Walk Away ", GUI.Quit)

var Q : int := GUI.CreateButton (10, 10, 0, "Quit", GUI.Quit)

end Q5













proc q4right




Q5

end q4right




proc q4wrong


cls

drawfillbox (50, 50, 500, 350, 54)

locatexy (70, 350)

color (57)

put "Name:", "" : 7, name

locatexy (60, 335)

put "amount:", "" : 7, "dollars", value

locatexy (60, 300)

put "Social Securiy Number:", "" : 7, SSN

locatexy (50, 60)

put "This Check Is Not Real, I Will Not Be Giving You Money"

GUI.Quit

end q4wrong




proc Q4




GUI.Dispose (B1)

GUI.Dispose (B2)

GUI.Dispose (B3)

GUI.Dispose (B4)

cls




Font.Draw ("$1,000 question", 10, 375, font1, yellow)

Font.Draw ("What Room Are We In ??", 10, 300, font1, purple)







value := 1000

B1 := GUI.CreateButton (100, 200, 0, "713", q4wrong)

B2 := GUI.CreateButton (100, 150, 0, "137", q4wrong)

B3 := GUI.CreateButton (100, 100, 0, "317", q4wrong)

B4 := GUI.CreateButton (100, 50, 0, "173", q4right)

fifty := GUI.CreateButton (300, 200, 0, "Fifty-fifty", fiftyfifty)

Phone := GUI.CreateButton (300, 150, 0, "phone a friend", phone)

var Q : int := GUI.CreateButton (10, 10, 0, "Quit", GUI.Quit)

W := GUI.CreateButton (300, 100, 0, "Walk Away ", GUI.Quit)

end Q4




proc q3right




Q4

end q3right




proc q3wrong


cls

drawfillbox (50, 50, 500, 350, 54)

locatexy (70, 350)

color (57)

put "Name:", "" : 7, name

locatexy (60, 335)

put "amount:", "" : 7, "dollars", value

locatexy (60, 300)

put "Social Securiy Number:", "" : 7, SSN

locatexy (50, 60)

put "This Check Is Not Real, I Will Not Be Giving You Money"

GUI.Quit

end q3wrong




proc Q3

GUI.Dispose (B1)

GUI.Dispose (B2)

GUI.Dispose (B3)

GUI.Dispose (B4)




cls




Font.Draw ("$500 question", 10, 375, font1, purple)

Font.Draw ("How Many classes Do We Have A Day??", 10, 300, font1, green)

value := 0










B1 := GUI.CreateButton (100, 200, 0, "5", q3wrong)

B2 := GUI.CreateButton (100, 150, 0, "4", q3right)

B3 := GUI.CreateButton (100, 100, 0, "3", q3wrong)

B4 := GUI.CreateButton (100, 50, 0, "6", q3wrong)

fifty := GUI.CreateButton (300, 200, 0, "Fifty-fifty", fiftyfifty)

Phone := GUI.CreateButton (300, 150, 0, "phone a friend", phone)

W := GUI.CreateButton (300, 100, 0, "Walk Away ", GUI.Quit)




end Q3







proc q2right




Q3

end q2right




proc q2wrong


cls

drawfillbox (50, 50, 500, 350, 54)

locatexy (70, 350)

color (57)

put "Name:", "" : 7, name

locatexy (60, 335)

put "amount:", "" : 7, "dollars", value

locatexy (60, 300)

put "Social Securiy Number:", "" : 7, SSN

locatexy (50, 60)

put "This Check Is Not Real, I Will Not Be Giving You Money"

GUI.Quit

end q2wrong







proc Q2

cls

GUI.Dispose (B1)

GUI.Dispose (B2)

GUI.Dispose (B3)

GUI.Dispose (B4)

cls

Font.Draw ("$200", 10, 375, font1, yellow)

Font.Draw ("How Many Months In A Year??", 10, 300, font1, red)

value := 0




B1 := GUI.CreateButton (100, 200, 0, "5", q2wrong)

B2 := GUI.CreateButton (100, 150, 0, "9", q2wrong)

B3 := GUI.CreateButton (100, 100, 0, "7", q2wrong)

B4 := GUI.CreateButton (100, 50, 0, "12", q2right)

fifty := GUI.CreateButton (300, 200, 0, "Fifty-fifty", fiftyfifty)

Phone := GUI.CreateButton (300, 150, 0, "phone a friend", phone)

W := GUI.CreateButton (300, 100, 0, "Walk Away ", GUI.Quit)

end Q2










proc q1right

put "you won $100"

Q2

end q1right




proc q1wrong


cls

drawfillbox (50, 50, 500, 350, 54)

locatexy (70, 350)

color (57)

put "Name:", "" : 7, name

locatexy (60, 335)

put "amount:", "" : 7, "dollars", value

locatexy (60, 300)

put "Social Securiy Number:", "" : 7, SSN

locatexy (70, 60)

put "This Check Is Not Real, I Will Not Be Giving You Money"

GUI.Quit

end q1wrong




proc Q1

cls

GUI.Dispose (P)

GUI.Dispose (q)



colorback (black)

cls


Font.Draw ("For $100 ", 10, 365, font1, brightred)

Font.Draw ("In What Year Did World War One Brake Out", 10, 300, font1, yellow)

value := 0

color (purple)



B1 := GUI.CreateButton (100, 200, 0, "1920", q1wrong)

B2 := GUI.CreateButton (100, 150, 0, "1913", q1wrong)

B3 := GUI.CreateButton (100, 100, 0, "1910", q1wrong)

B4 := GUI.CreateButton (100, 50, 0, "1914", q1right)

right_answer := B4

fifty := GUI.CreateButton (300, 200, 0, "Fifty-fifty", fiftyfifty)

Phone := GUI.CreateButton (300, 150, 0, "phone a friend", phone)

W := GUI.CreateButton (300, 100, 0, "Walk Away ", GUI.Quit)



end Q1



%the title page/first page

color (red)

locate (11, 27)

colorback (101)

put "Welcome to the Gameshow:"

locate (12, 25)

put "WHO WANTS TO BE A MILLIONAIRE!"

drawfillbox (430, 300, maxx, 200, black)

drawfillbox (400, 300, maxx, 225, black)




delay (500)

color (purple)

locate (2, 3)

put "please enter your name"

drawfillbox (200, 350, maxx, 400, black)

get name : *

locate (4, 3)

put "Please Enter You Social Security Number"

drawfillbox (330, 300, maxx, 400, black)

get SSN


cls



colorback (black)

cls



P := GUI.CreateButton (100, 100, 0, "Play The Game", Q1)

q := GUI.CreateButton (250, 100, 0, "Runaway without playing", GUI.Quit)



loop

exit when GUI.ProcessEvent

end loop


Author:  CodeMonkey2000 [ Mon Jun 09, 2008 10:48 pm ]
Post subject:  RE:millionaire-isu, can u help ??

First off your code is extremely inefficient. When you are copying and pasting large segments of code, it's not a good sign. But it's too late to fix that now. Secondly turing's GUI kind of.....sucks.

So now, on to your problem. Telling us what's wrong, or what you need help with would be nice Very Happy

Author:  riveryu [ Mon Jun 09, 2008 10:58 pm ]
Post subject:  Re: millionaire-isu, can u help ??

If you did not know already, procedures can have parameters.
They can save a lot of space when you want to repeat the same code with only variations in a few values.
Look into F10 Help.

Author:  jeffgreco13 [ Tue Jun 10, 2008 8:52 am ]
Post subject:  Re: millionaire-isu, can u help ??

"Please enter your social security number"

LOL why?

But, yeah, give us some detail on your problems. We'll help but it's your FP, were not doing it for you.

Author:  jdubzisyahweh [ Wed Feb 24, 2010 12:38 pm ]
Post subject:  RE:millionaire-isu, can u help ??

lol, you were in swayze' class werent u, i was too


: