setscreen ("graphics:v16"
colourback (1)
colour (14)
var points, score : int := 0
procedure graphics
%answer box
drawbox (20, 50, 200, 100, 14)
drawbox (21, 51, 199, 99, 14)
%question box
drawbox (50, maxy - 90, maxx - 50, maxy - 50, 14)
drawbox (51, maxy - 89, maxx - 51, maxy - 51, 14)
%point box
drawbox (35, 200, 125, 250, 14)
locatexy (50, 225)
put score ..
end graphics
procedure questiontype (input : string)
drawbox (200, 200, maxx - 50, 300, 14)
if input = "o" then
locatexy (213, 280)
put "This is a one word answer." ..
locatexy (213, 270)
put "Please enter one word for your answer in " ..
locatexy (213, 255)
put "lowercase." ..
points := 15
elsif input = "t" then
locatexy (213, 280)
put "This is a true of false question." ..
locatexy (213, 270)
put "Please enter t or f for your answer." ..
locatexy (213, 255)
put "lowercase." ..
points := 10
elsif input = "b" then
locatexy (213, 280)
put "This is a fill in the blanks question." ..
locatexy (213, 270)
put "Please enter one word for your answer in " ..
locatexy (213, 255)
put "lowercase." ..
points := 13
end if
end questiontype
procedure waste (l : int)
for x : 1 .. (l * 1000)
var waste : int := 353 * 4252 * 342
end for
end waste
procedure win
cls
graphics
var y : int
y := 101
loop
drawfillbox (20, 100, 200, y, 14)
y := y + 1
exit when y = 130
waste (1)
end loop
score := score + points
locatexy (100, 110)
put "Correct!" ..
waste (1)
end win
procedure lose
cls
graphics
var y : int
y := 101
loop
drawfillbox (20, 100, 200, y, 14)
y := y + 1
exit when y = 130
waste (1)
end loop
locatexy (100, 110)
put "Wrong!" ..
waste (1)
end lose
var guess : string
var fh : int
var typeOfQuestion, question, answer : string
open : fh, "question.txt", get
loop
get : fh, typeOfQuestion, question, answer
graphics
locatexy (60, maxy - 64)
put question
graphics
questiontype (typeOfQuestion)
locatexy (40, 75)
get guess
if guess = answer
then
win
else
lose
end if
exit when eof (fh)
end loop
loop
exit when hasch
end loop
colourback (1)
colour (14)
var points, score : int := 0
procedure graphics
%answer box
drawbox (20, 50, 200, 100, 14)
drawbox (21, 51, 199, 99, 14)
%question box
drawbox (50, maxy - 90, maxx - 50, maxy - 50, 14)
drawbox (51, maxy - 89, maxx - 51, maxy - 51, 14)
%point box
drawbox (35, 200, 125, 250, 14)
locatexy (50, 225)
put score ..
end graphics
procedure questiontype (input : string)
drawbox (200, 200, maxx - 50, 300, 14)
if input = "o" then
locatexy (213, 280)
put "This is a one word answer." ..
locatexy (213, 270)
put "Please enter one word for your answer in " ..
locatexy (213, 255)
put "lowercase." ..
points := 15
elsif input = "t" then
locatexy (213, 280)
put "This is a true of false question." ..
locatexy (213, 270)
put "Please enter t or f for your answer." ..
locatexy (213, 255)
put "lowercase." ..
points := 10
elsif input = "b" then
locatexy (213, 280)
put "This is a fill in the blanks question." ..
locatexy (213, 270)
put "Please enter one word for your answer in " ..
locatexy (213, 255)
put "lowercase." ..
points := 13
end if
end questiontype
procedure waste (l : int)
for x : 1 .. (l * 1000)
var waste : int := 353 * 4252 * 342
end for
end waste
procedure win
cls
graphics
var y : int
y := 101
loop
drawfillbox (20, 100, 200, y, 14)
y := y + 1
exit when y = 130
waste (1)
end loop
score := score + points
locatexy (100, 110)
put "Correct!" ..
waste (1)
end win
procedure lose
cls
graphics
var y : int
y := 101
loop
drawfillbox (20, 100, 200, y, 14)
y := y + 1
exit when y = 130
waste (1)
end loop
locatexy (100, 110)
put "Wrong!" ..
waste (1)
end lose
var guess : string
var fh : int
var typeOfQuestion, question, answer : string
open : fh, "question.txt", get
loop
get : fh, typeOfQuestion, question, answer
graphics
locatexy (60, maxy - 64)
put question
graphics
questiontype (typeOfQuestion)
locatexy (40, 75)
get guess
if guess = answer
then
win
else
lose
end if
exit when eof (fh)
end loop
loop
exit when hasch
end loop