/////////////////////////
// this is the sequence that plays for a correct answer...
/////////////////////////

to correct

clear; moveto middle; logo linecolor = "red"
pointlist clearall
pointlist startcapture
  pointlist loadfile "ptsfiles/wham.pts"
pointlist endcapture
set scale = 0.3
repeat (calc 10 + random 4) [
    eraseshape
    pointlist render middle :scale
    wait 2
    incr scale by 0.1
    ]
logo textsize = 15
pu; moveto middle; sayc "CORRECT!"
logo textsize = 10
incr ncorrect by 1
logo linecolor = "black"
end
  

/////////////////////////
// this is the sequence that plays for a wrong answer...
/////////////////////////

to wrong

clear; moveto middle
pointlist clearall
pointlist startcapture
  pointlist loadfile "ptsfiles/frowny.pts"
pointlist endcapture
pd
pointlist render middle 1.0
pu
logo textsize = 15
moveto center 200
sayc "Sorry, that's not correct."
logo textsize = 10
end



/////////////////////////
// Quiz questions begin here..
/////////////////////////

logo animation /// prevents printing..
logo linecolor = "black"
set ncorrect = 0

/////// Question 1
clear; pu; set ypos = 600; moveto center :ypos 
sayc "Question 1. Which country is on the Mediterranean Sea?"
set ans = buttonchoice "" "Germany|Italy|Japan|England"
if :ans = "Italy" [ correct ]  else [ wrong ]

set k = buttonchoice "Another question?" "Yes|No"
if :k = "no" [ end ]


//////// Question 2
clear; pu; set ypos = 600; moveto center :ypos 
sayc "Question 2. Which country is usually cold in August?"
set ans = buttonchoice "" "China|Egypt|Mexico|New Zealand"
if :ans = "New Zealand" [ correct ]  else [ wrong ]

set k = buttonchoice "Another question?" "Yes|No"
if :k = "no" [ end ]


//////// Question 3
clear; pu; set ypos = 600; moveto center :ypos 
sayc "Question 3. Which of these countries is the largest?"
set ans = buttonchoice "" "Belgium|China|Egypt|Panama"
if :ans = "China" [ correct ] else [ wrong ]


//// end of quiz...
moveto center 100; sayc concat 3 "You got " :ncorrect " answers correct."
buttonchoice "Thanks for trying this quiz." "Done"
