Configuring TRAKLA2 offline version applets

Introduction

Offline versions of TRAKLA2 applets are intended, for example, for a lecturer who can demonstrate the working of an algorithm or a learner who can practice an algorithm after the lecture.

The offline versions make it possible for a user to assess the correctness of his/her answer by pushing the "Grade my solution" button. User can also view the model answer of the exercise by using the "Model answer" button. Moreover, the user can reset the exercise by the "Reset" button in which case the exercise is reinitialized but with new random initial values.

This short document describes the functionality of the TRAKLA2 exercise applet that can be configured to suit better various needs. For example, "Model answer" and "Grade my solution" buttons can be disabled if users should not be able to get the correct answers for exercises immediately. Moreover, the exercise can be initialized to fixed values so that using "Reset" button will always restore the exercise to the same initial state.

Configuring applets

Applets can be configured by modifying the applet parameters in the html file.

Applet parameters and their possible values

Table 1: Parameter names, descriptions, and possible values. Default value is used if parameter is not set in the html file. The column "compulsory" indicates whether the parameter has to be set in the html file.
Parameter name Description and possible values Default value Compulsory
exercise_class (or ex) Describes the name of the exercise class which should be loaded into the applet. (Example: content.exercises.BFS) No default value Yes
font_size Defines the size of the font used in the applet. 12 No
swap Switches the swapping functionality of the keys on or off. off No
grading 1 -> grading button enabled
0 -> grading button disabled
1 No
reset_bg 1 -> reset is enabled only after grading
0 -> reset depends on "reset" parameter
0 No
reset if "reset_bg" is set to 1 this parameter is not applicable
1 -> reset button is enabled
0 -> reset button is disabled
1 No
modelanswer_bg 1 -> modelanswer is enabled only after grading
0 -> modelanswer depends on "modelanswer" parameter
0 No
modelanswer if "modelanswer_bg" is set to 1 this parameter is not applicable
1 -> modelanswer button is enabled
0 -> modelanswer button is disabled
1 No
seed Defines the seed which is used when generating randomly the initial values of the exercise.
if >= 0 -> fixed seed is used always
else random seed is used every time (taken from current time)
-1 (which means that current time is used as a default value) No

Example

The following is an example html file, and contains some additional parameters that can be given to the applet.


<HTML>

<HEAD><TITLE>Matrix applet</TITLE></HEAD>
<BODY>
<h1>BFS</h1>
<div>Visit the nodes in BFS order. Begin your work from line 5 of the algorithm. 
The starting node <b>s</b> for the algorithm is node <b>A</b>.


</p>

<p></p>

<p>Algorithm <b>BFS</b>(G, s)
<ol>
<li>Initialize empty queue Q


<li><b>for each</b> u ∈ V[G] <b>do</b>
<li>     visited[u] ← false

<li>     finished[u] ← false

<li>visited[s] ← true
<li>ENQUEUE(Q, s)

<li><b>while</b> Q not empty <b>do</b>
<li>     u ← DEQUEUE(Q)

<li>     <b>for each</b> v ∈ Adj[u] <b>do</b>

<li>          <b>if</b> visited[v] = false <b>then</b>

<li>               visited[v] ← true
<li>               ENQUEUE(Q, v)
<li>     finished[u] ← true
</ol>
</p>

<ul>

<li>Push "Mark Visited" button to mark a node visited.
<li>Push "Mark Finished" button to mark a node finished.
</ul></div>
<hr/>

<applet
 code="applications.exerciseapplet.ExerciseApplet.class" width=800 height=900>
<param name="ex" value="content.exercises.BFS">
<param name="font_size" value="14">

<param name="swap" value="off">
<param name="grading" value="0">
<param name="modelanswer" value="0">
<param name="seed" value="12">
</applet>

</BODY>
</HTML>

Explanations for parameters in the example

Exercise page and the applet

Here is a picture of the corresponding exercise page and the applet:

TRAKLA2 exercise page and the applet
Figure 1: Picture of the exercise page and applet. "Model answer" and "Grade my solution" buttons are disabled. In addition, pushing the "Reset" button would reinitialize the exercise applet with the same graph.