|
This is the pure quizz applet. The applet show a question and the user must choice one of the possible responses.
The plus of this applet is to interest the player by showing a photo with a mosaic. The more you answer the questions, the better is the photo resolution.
When a photo is discover, the applet loads another one and the game continue. If you find a good subject, the player will absolutely want to discover the photo and will try to answer to the question seriously. Isn't it your goal ? How does it work :Photoquiz first load randomly one of the images. All the image must have the same filename representation ( for example img0.gif, img1.gif, img2.gif ). Parameters are provided to define the model of the image file name.Then photoquiz loads the questions. If you have a little set of question ( less than 50 for example), the best is to ask photoquiz to load the complete set at the initialisation. If you have a great set of question, give in parameter a script and the number of question photoquiz must load each time. When the player has seen 75% of the questions, Photoquiz will call the script to load a new set of questions. The precedent questions will be kept for a new game. How does a question file look like ?A question file still have the same profile :
I want to add a question in my file
q,1,1+1=?,1,2,3 Exemple 1 : One load usageIn this example, the applet load all the questions at the initialisation. HTML Code<applet code="photoquiz.class" archive="photoquiz.jar" width="260" height="400"> <param name="qf" value="math.txt"> <param name="nqm" value="5"> <param name="nim" value="3"> <param name="mh" value="260"> <param name="bg" value="ffce63"> <param name="fontname" value="arial"> <param name="fontsize" value="12"> <param name="if" value="./image#.jpg"> <param name="oneload" value=""> </applet> The file math.txtq,1,1+1=,1,2,3 q,0,3*4=,12,20,8 q,2,1 or 0 =,0, 2,1 q,1,0 nor 0 =,0,1,2 Usage with scriptsIn this example, the applet call a script wich load five questions each time. This is an example because the question file contains only ten question. But if you have hundreds of questions and doesn't want your user to wait to much time, it can be a good answer. Here is the PHP script file :
<?
$f = file ($fn);
$i = 0;
while ( $i++ < 5 && $nl < count($f) )
{
print $f[$nl++];
}
?>
It is very simple and only read 5 lines from a text file. The first line to read is given by the parameter nl. It is a very simple example but we can imagine data read from a database.
HTML Code<applet code="photoquiz.class" archive="photoquiz.jar" width="260" height="400"> <param name="qf" value="./getquestion.php?fn=math.txt&nl=#"> <param name="nqm" value="5"> <param name="nim" value="3"> <param name="mh" value="260"> <param name="bg" value="ffce63"> <param name="if" value="./image#.jpg"> </applet> Photoquiz parameters
|