[LON-CAPA-users] condition statement syntax in RAT

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Thu, 23 Dec 2004 22:55:19 -0500 (EST)

Hi Jim,

> Does anyone have an example of a conditional RAT sequence? 

I do.

There are two ways to ask about a resource.

1) pass the symb, a symb currently looks like

So for the resource /res/msu/albertel/test.problem
in /res/msu/albertel/test.sequence
with resource id 15
it would be


2) rename the resource using the 'mapalias' parameter and then use that

I've used that in the folowing example, which does this

first you are shown 1.problem

After 2 tries on 1.problem, it disappears and you can get to 2.problem

Once you get 2.problem correct, you are shown 1.problem again

If you get 1.problem wrong again you are shown 3.problem

Once you get 3.problem correct, you are shown 1.problem again

If you get 1.problem wrong again you are shown 4.problem

Once you get 4.problem correct, you are shown 1.problem again

If you get 1.problem wrong again you are shown 5.problem

Once you get 5.problem correct, you are shown 1.problem again.

And I guess you can try 1.problem until maxtries now.

This almost works completely correctly, there are some user interface
issues that I haven't fully addressed but are in the works. Take a
look at the comments in lonhomework.pm

Doing this in a .page would be best, but lonpage.pm needs, er, work.
Some design ideas have been floated (it need to reparse the <map>
between resoruces but how to do that so it does make the system dog
slow for normal users is still trying to be figured out.)

<param to="5" value="mainproblem" name="parameter_0_mapalias" type="string"></param>
<param to="7" value="2nd_problem" name="parameter_0_mapalias" type="string"></param>
<param to="10" value="3rd_problem" name="parameter_0_mapalias" type="string"></param>
<param to="13" value="4th_problem" name="parameter_0_mapalias" type="string"></param>
<param to="16" value="5th_problem" name="parameter_0_mapalias" type="string"></param>
<resource src="" id="1" type="start" title="Start"></resource>
<resource src="" id="2" type="finish" title="Finish"></resource>
<resource src="/res/annarbor/albertel/b_and_c/1.problem" id="5" title="1.problem"></resource>
<resource src="/res/annarbor/albertel/b_and_c/2.problem" id="7" title="2.problem"></resource>
<resource src="/res/annarbor/albertel/b_and_c/3.problem" id="10" title="3.problem"></resource>
<resource src="/res/annarbor/albertel/b_and_c/4.problem" id="13" title="4.problem"></resource>
<resource src="/res/annarbor/albertel/b_and_c/5.problem" id="16" title="5.problem"></resource>
<condition value="&EXT('user.resource.resource.0.tries','mainproblem') >1 && &EXT('user.resource.resource.0.tries','mainproblem') <3" id="58" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.tries','mainproblem') >2 && &EXT('user.resource.resource.0.tries','mainproblem') <4" id="59" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.tries','mainproblem') >4 " id="60" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.tries','mainproblem') <2 " id="61" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.tries','mainproblem') >3 && &EXT('user.resource.resource.0.tries','mainproblem') <5" id="62" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.solved','mainproblem') eq 1`" id="63" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.solved','5th_problem') eq 1 " id="64" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.solved','2nd_problem') eq 1" id="65" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.solved','3rd_problem') eq 1" id="66" type="stop"></condition>
<condition value="&EXT('user.resource.resource.0.solved','4th_problem') eq 1" id="67" type="stop"></condition>
<link to="5" index="1" from="1" condition="61"></link>
<link to="13" index="2" from="1" condition="62"></link>
<link to="10" index="3" from="1" condition="59"></link>
<link to="7" index="4" from="1" condition="58"></link>
<link to="16" index="5" from="1" condition="60"></link>
<link to="5" index="6" from="16" condition="64"></link>
<link to="5" index="7" from="7" condition="65"></link>
<link to="5" index="8" from="10" condition="66"></link>
<link to="5" index="9" from="13" condition="67"></link>
<link to="2" index="10" from="5" condition="63"></link>

guy@albertelli.com  LON-CAPA Developer  0-7-3-2-