It
is possible to use the new parser to do the string checking for you.
The Parser handles the TeX display of constants differently from the
standard string answer checker, and it also provides a method for you
to set the TeX string for it to use. Here is a code snippet that you
could use to replace ANS(str_cmp("<=")) in the problem you cite above:
loadMacros("contextString.pl"); Context()->strings->are( '<' => {}, '<=' => {}, '=' => {}, '>=' => {}, '>' => {}, ); ANS(string_cmp("<="));
(The empty braces could be used to define the TeX string to use, or other parameters, but there is no need to in this case).
You might also consider replacing the second answer blank by a
pull-down menu that contains the five choices that you want to use.
This might make it unnecessary to have the explanations of what to type
and which blanks are for what. If you want to try that, you can replace
the second ans_rule call with
pop_up_list( "" => "", "<" => "<", "<=" => "<=", "=" => "=", ">=" => ">=", ">" => ">", )
Here, the first of the two copies of each inequality is the label used
in the popup menu, and the second is the answer string that it produces.
Finally, it would be possible to use the new parser to define the
inequalities so that students can type their answers as, for example, x^2 + y^2 + z^2 <= 25 ,
but that would take a bit of coding and I don't currently have time to
do it. I'll try to get to it soon and post an example here.
Davide
<| Post or View Comments |>
|