<problem>
<outtext>
In the fllowing questions remember that a tomato is a fruit.
I have presented a couple of ideas on how this might be done.
I am presuming a random function that returns an integer between the
two arguments given.
</outtext>
<part>
<outtext>
Please select the fruit from the list below.
This one attempts to be very simple I think to edit and recreate
from the editor.
</outtext>
<script>
$numoftrueleafs=2;
$numoffalseleafs=4;
$numofpresentedleafs=4;
$whichtrue=random(1,$numoftrueleafs);
@whichfalse=pick(3,1,$numoffalseleafs); #pick(x,y,z), Picks x
#inetgers between y and z
</script>
<randomlist>
<comment>
maybe <block order="random"></block> is better?
The idea is that the following top level blocks get parsed in
random order.
</comment>
<radio value=false condition="&ismemberoflist(1,@whichfalse)">
Trucks
</radio>
<radio value=false condition="&ismemberoflist(2,@whichfalse)">
Cars
</radio>
<radio value=false condition="&ismemberoflist(3,@whichfalse)">
Guy Albertelli
</radio>
<radio value=false condition="&ismemberoflist(4,@whichfalse)">
Computers
</radio>
<radio value=true condition="1==$whichtrue">Oranges</radio>
<radio value=true condition="2==$whichtrue">Tomatoes</radio>
</randomlist>
</part>
<part>
<outtext>
Please select the fruit from the list below.
This one attempts to be easier to type in by hand, but more
troublesome to automate editing for. Also lets the parser been
even less smart.
</outtext>
<script>
$numoftrueleafs=2;
@trueleafs=('Oranges','Tomatoes');
$numoffalseleafs=4;
@falseleafs=('Trucks','Cars','Guy Albertelli','Computers');
$numpresentedleafs=4;
$whichtrue=random(1,$numoftrueleafs);
@whichfalse=pick($numpresentedleafs,@falseleafs); #Picks 3 items from the list
$randseed=random(1,1000);
@leafs=&map(randseed,$numpresentedleafs,(@trueleafs[$whichtrue],@whichfalse));
@value=&map(randseed,$numpresentedleafs,('true','false','false','false'));
</script>
<radio value="@value[1]"> @leafs[1] </radio>
<radio value="@value[2]"> @leafs[2] </radio>
<radio value="@value[3]"> @leafs[3] </radio>
<radio value="@value[4]"> @leafs[4] </radio>
<comment>
Can tags inside a <script></script> be parsed? if so stick the
radio button generation as a loop inside the script block.
</comment>
</part>
<part>
<outtext>
Select the word from the drop down box that best matches.
</outtext>
<script>
@options=('Fruit','Vehicle','Person','Place');
</script>
<randomlist>
<comment>
To have different options appear for different students.
You could add conditions similar to the way the first radio
button one works.
Or you could do somthing along the lines of the second one and
do all of the choosing in the script, setting a list of values
and the associated text to that value.
I could whip a couple examples of this up, but I think you
could too.
</comment>
<outtext>
Tomatoes are <list value="1" possible="@options"></list>
</outtext>
<outtext>
<list value="1" possible="@options"></list> can be found
growing on trees.
</outtext>
<outtext>
Istanbul is a <list value="4" possible="@options"></list>
</outtext>
</randomlist>
</part>
</problem>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>