Ok here is the code
Turing: |
%Programming Bonanza!
%Ricardo Rodrigues
%December 8, 2008
%Do the quizzes, prove your the programming master!
%Variables go here
var x : int
var y : int
var button : int
var choice : string := ""
var name1 : string
var grade1 : int
var font : int
var response : string
var quiztype : int
var quiztype2 : string
var last : int
var tq1answer : real
var tq1answer2 : string
var tq2answer : int
var tq2answer2 : string
var tq3answer : int
var tq3answer2 : string
var tq4answer : int
var tq4answer2 : string
var tq5answer : int
var tq5answer2 : string
var tq6answer : int
var tq6answer2 : string
var tq7answer : int
var tq7answer2 : string
var tq8answer : int
var tq8answer2 : string
var tq9answer : int
var tq9answer2 : string
var tq10answer : int
var tq10answer2 : string
%Screen Settings Start
View.Set ("graphics:1000;650")
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
colorback (black)
color (white)
%Screen Settings End
%Fonts Start
font := Font.New ("BadaBoom BB:30")
%Fonts End
%%%%%%%%%%%%%%%%%%%%%%%%
%%%%Procedures Start%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
%Get User Information Start
procedure name
put "Welcome to Programming Bonanza!"
put "Please state first name."
get name1
end name
procedure grade %Get Users School grade
put "What grade are you in ", name1, "?"
get grade1
end grade
%Get User Information End
procedure StartProgram
name
grade
end StartProgram
procedure Index
cls
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
%Index Button Images Start
Pic.ScreenLoad ("Quiz.bmp", - 130, - 150, picMerge) %Quiz Start Image
Pic.ScreenLoad ("Instructions.bmp", 550, 420, picMerge) %Instruction Image
Pic.ScreenLoad ("Lessons.bmp", - 90, 420, picMerge) %Lessons Image
Pic.ScreenLoad ("Credits.bmp", 640, - 150, picMerge) %Credits Image
%Index Button Images End
loop
Mouse.Where (x, y, button )
if x >= 5 and x <= 200 and y >= 2 and y <= 80 and button = 1 then
choice := "quizselect"
exit when x >= 5 and x <= 200 and y >= 2 and y <= 80 and button = 1
elsif x >= 580 and x <= 990 and y >= 580 and y <= 700 and button = 1 then
choice := "instructions"
exit when x >= 580 and x <= 990 and y >= 580 and y <= 700 and button = 1
elsif x >= 5 and x <= 200 and y >= 580 and y <= 700 and button = 1 then
choice := "lessons"
exit when x >= 5 and x <= 200 and y >= 580 and y <= 700 and button = 1
elsif x >= 600 and x <= 990 and y >= 2 and y <= 80 and button = 1 then
choice := "credits"
exit when x >= 600 and x <= 990 and y >= 2 and y <= 80 and button = 1
end if
%Index Instructions start
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 1)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 2)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 3)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 4)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 5)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 6)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 7)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 8)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 9)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 10)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 11)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 12)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 13)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 14)
delay (100)
Font.Draw ("Please Click One Of The Four Buttons To Continue.", 75, 325, font, 15)
delay (100)
%Index Instructions end
end loop
end Index
%Index Page End
procedure QuizSelect %Quiz Start
cls
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
put "Please select your Quiz Type, by typing in the corresponding number."
put "1. Turing"
put "2. Alice"
put "3. HTML"
get quiztype
%Turing Quiz
if quiztype = 1 then
quiztype2 := "Turing"
cls
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question One Start
put "Question One"
put "What is the proper command to allow a user to input data into the program?"
put "1. say"
put "2. input"
put "3. enter"
put "4. put"
get tq1answer
if tq1answer = 4 then
tq1answer2 := "put"
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 4. put!"
delay (2000)
cls
end if
%Turing Question One End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Two Start
put "Question Two"
put "Which is the correct list of variable types?"
put "1. string, int, tan"
put "2. tan, int, str"
put "3. real, int, str"
put "4. int, string, real"
get tq2answer
if tq2answer = 4 then
tq2answer2 := "int, string, real"
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 4. int, string, real!"
delay (2000)
cls
end if
%Turing Question Two End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing question Three Start
put "Question 3"
put "What is the improper way to input a variable name?"
put "1. clickme"
put "2. 28alpha"
put "3. answer"
put "4. amount"
get tq3answer
if tq3answer = 2 then
tq3answer2 := "28alpha"
put "Correct Answer"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 2. 28alpha"
delay (2000)
cls
end if
%Turing Question Three End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Four Start
put "Question 4"
put "What command is used to set a background color?"
put "1. colorback (colorname)"
put "2. backgroundcolor (colorname)"
put "3. colorback (colornumber)"
put "4. back (colorname)"
get tq4answer
if tq4answer = 3 then
tq4answer2 := "colorback (colornumber)"
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 3. colorback (colornumber)"
delay (2000)
cls
end if
%Turing Question Four End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Five Start
put "Question 5"
put "What command is commonly used to repeat areas of code?"
put "1. loop"
put "2. repeat"
put "3. cycle"
put "4. redo"
get tq5answer
if tq5answer = 1 then
tq5answer2 := "loop"
put "Correct Answer"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 1. loop"
delay (2000)
cls
end if
%Turing Question Five End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Six Start
put "Question 6"
put "What command is used to make the program wait a certain amount of time?"
put "1. wait (amount)"
put "2. stop until (amount)"
put "3. delay (amount)"
put "4. standby (amount)"
get tq6answer
if tq6answer = 3 then
tq6answer2 := "delay (amount)"
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct Answer was 3. delay (ammount)"
delay (2000)
cls
end if
%Turing Question Six End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Seven Start
put "Question 7"
put "When starting to create a program what should you always do before beginning the actual code?"
put "1. Make a introduction page."
put "2. Declare you're variables."
put "3. Place Comments such as programmers name, date, title of program, and description."
put "4. Check you're program for bugs."
get tq7answer
if tq7answer = 3 then
tq7answer2 := "Place Comments such as programmers name, date, title of program, and description."
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 3. Place Comments such as programmers name, date, title of program, and description."
delay (2000)
cls
end if
%Turing Question Seven End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Eight Start
put "Question 8"
put "Some commands must be ended so that they can be completed. What is the first word used in all closing commands?"
put "1. close"
put "2. end"
put "3. exit"
put "4. leave"
get tq8answer
if tq8answer = 2 then
tq8answer2 := "end"
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 2. end"
delay (2000)
cls
end if
%Turing Question Eight End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Nine Start
put "Question 9"
put "What command is used to clear a page of text?"
put "1. clear"
put "2. clean"
put "3. cls"
put "4. erase"
get tq9answer
if tq9answer = 3 then
tq9answer2 := "cls"
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 3. cls"
delay (2000)
cls
end if
%Turing Question Nine End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%Turing Question Ten Start
put "Question 10"
put "When working with Turing it is usually necessary for a program to have secondary options, such as yes or no. What command is used to program these decisions?"
put "1. if and or"
put "2. if and else"
put "3. if and elsif"
put "4. if and either"
get tq10answer
if tq10answer = 3 then
tq10answer2 := "if and elsif"
put "Correct Answer!"
delay (2000)
cls
else
put "Wrong Answer!"
put "The correct answer was 3. if and elsif"
delay (2000)
cls
end if
%Turing Question Ten End
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
%End Questions
%Begin Score Tally
%End Score Tally
%Begin Quiz Ending Page
%End Quiz Ending Page
%Alice Quiz
elsif quiztype = 2 then
quiztype2 := "Alice"
randint (last, 0, 10)
for decreasing count : 10 .. 0
delay (1000)
cls
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
put "You're Quiz will begin in 10 seconds"
put count
end for
%HTML Quiz
elsif quiztype = 3 then
quiztype2 := "HTML"
randint (last, 0, 10)
for decreasing count : 10 .. 0
delay (1000)
cls
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
put "Your quiz will begin in 10 seconds"
put count
end for
end if
end QuizSelect
%Quiz Selection End
procedure Instructions %Instruction Page Start
cls
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
put "Instructions Go Here"
Pic.ScreenLoad ("Back.bmp", 690, - 150, picMerge)
loop
Mouse.Where (x, y, button )
if x >= 810 and x <= 1000 and y >= 2 and y <= 80 and button = 1 then
Index
exit when x >= 810 and x <= 1000 and y >= 2 and y <= 80 and button = 1
end if
end loop
end Instructions
%Instructions Page End
procedure Lessons %Lessons Page Start
cls
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
put "Lessons Go Here"
Pic.ScreenLoad ("Back.bmp", 690, - 150, picMerge)
loop
Mouse.Where (x, y, button )
if x >= 810 and x <= 1000 and y >= 2 and y <= 80 and button = 1 then
Index
exit when x >= 810 and x <= 1000 and y >= 2 and y <= 80 and button = 1
end if
end loop
end Lessons
%Lessons Page End
procedure Credits %Credits Page Start
cls
%Background Set Up Start
locate (11, 1)
Pic.ScreenLoad ("matrix.bmp", 0, 0, picCopy)
drawfillbox (0, 300, maxx, 500, black)
%Background Set Up End
put "Credits Go Here"
Pic.ScreenLoad ("Back.bmp", 690, - 150, picMerge)
loop
Mouse.Where (x, y, button )
if x >= 810 and x <= 1000 and y >= 2 and y <= 80 and button = 1 then
Index
exit when x >= 810 and x <= 1000 and y >= 2 and y <= 80 and button = 1
end if
end loop
end Credits
%Credits Page End
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%End Procedures%%%%
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%Game Start%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%
StartProgram
loop
Index
case choice of
label "credits" :
Credits
label "instructions" :
Instructions
label "lessons" :
Lessons
label "quizselect" :
QuizSelect
end case
end loop
|
Ok Here is the entire code, There are some extra variables because i am planning on adding more things, and there also 2 empty Quiz areas. |