1: <problem>
2: <outtext>
3: In the fllowing questions remember that a tomato is a fruit.
4:
5: I have presented a couple of ideas on how this might be done.
6:
7: I am presuming a random function that returns an integer between the
8: two arguments given.
9: </outtext>
10: <part>
11: <outtext>
12: Please select the fruit from the list below.
13:
14: This one attempts to be very simple I think to edit and recreate
15: from the editor.
16: </outtext>
17: <script>
18: $numoftrueleafs=2;
19: $numoffalseleafs=4;
20: $numofpresentedleafs=4;
21: $whichtrue=random(1,$numoftrueleafs);
22: @whichfalse=pick(3,1,$numoffalseleafs); #pick(x,y,z), Picks x
23: #inetgers between y and z
24: </script>
25: <randomlist>
26: <comment>
27: maybe <block order="random"></block> is better?
28: The idea is that the following top level blocks get parsed in
29: random order.
30: </comment>
31: <radio value=false condition="&ismemberoflist(1,@whichfalse)">
32: Trucks
33: </radio>
34: <radio value=false condition="&ismemberoflist(2,@whichfalse)">
35: Cars
36: </radio>
37: <radio value=false condition="&ismemberoflist(3,@whichfalse)">
38: Guy Albertelli
39: </radio>
40: <radio value=false condition="&ismemberoflist(4,@whichfalse)">
41: Computers
42: </radio>
43: <radio value=true condition="1==$whichtrue">Oranges</radio>
44: <radio value=true condition="2==$whichtrue">Tomatoes</radio>
45: </randomlist>
46: </part>
47: <part>
48: <outtext>
49: Please select the fruit from the list below.
50:
51: This one attempts to be easier to type in by hand, but more
52: troublesome to automate editing for. Also lets the parser been
53: even less smart.
54: </outtext>
55: <script>
56: $numoftrueleafs=2;
57: @trueleafs=('Oranges','Tomatoes');
58: $numoffalseleafs=4;
59: @falseleafs=('Trucks','Cars','Guy Albertelli','Computers');
60: $numpresentedleafs=4;
61: $whichtrue=random(1,$numoftrueleafs);
62: @whichfalse=pick($numpresentedleafs,@falseleafs); #Picks 3 items from the list
63: $randseed=random(1,1000);
64: @leafs=&map(randseed,$numpresentedleafs,(@trueleafs[$whichtrue],@whichfalse));
65: @value=&map(randseed,$numpresentedleafs,('true','false','false','false'));
66: </script>
67: <radio value="@value[1]"> @leafs[1] </radio>
68: <radio value="@value[2]"> @leafs[2] </radio>
69: <radio value="@value[3]"> @leafs[3] </radio>
70: <radio value="@value[4]"> @leafs[4] </radio>
71: <comment>
72: Can tags inside a <script></script> be parsed? if so stick the
73: radio button generation as a loop inside the script block.
74: </comment>
75: </part>
76: <part>
77: <outtext>
78: Select the word from the drop down box that best matches.
79: </outtext>
80: <script>
81: @options=('Fruit','Vehicle','Person','Place');
82: </script>
83: <randomlist>
84: <comment>
85: To have different options appear for different students.
86:
87: You could add conditions similar to the way the first radio
88: button one works.
89:
90: Or you could do somthing along the lines of the second one and
91: do all of the choosing in the script, setting a list of values
92: and the associated text to that value.
93:
94: I could whip a couple examples of this up, but I think you
95: could too.
96: </comment>
97: <outtext>
98: Tomatoes are <list value="1" possible="@options"></list>
99: </outtext>
100: <outtext>
101: <list value="1" possible="@options"></list> can be found
102: growing on trees.
103: </outtext>
104: <outtext>
105: Istanbul is a <list value="4" possible="@options"></list>
106: </outtext>
107: </randomlist>
108: </part>
109: </problem>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>