File:  [LON-CAPA] / loncom / homework / templates / CustomResponse.problem
Revision 1.3: download - view: text, annotated - select for diffs
Mon Jul 6 17:12:47 2009 UTC (14 years, 10 months ago) by bisitz
Branches: MAIN
CVS tags: version_2_9_99_0, bz6209-base, bz6209, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3
Consistent problem templates:
- New line after each tag (not for texts in foils)
- One empty row after each end tag and before new start tag for second level tags
- No indentation for second level tags, e.g. <script>
- Four white spaces as indentation for each further sub level
    Exceptions:
        -Content (mostly text) in separate line(s): no indentation
        - Concept groups: same indentation as foilgroup
          (allows to insert code from problems without concept groups without changing the indentation and vice versa)
- No new line at end of template
- Removed new lines from within the middle of default texts
- Added one blank each after "<m>$" and before "$</m>" to ensure no misinterpretation neither by human nor by machine (e.g. "<m>$x" is not "<m>$ $x")
- Replaced deprecated font tag in <instructorcomment> by CSS
- Removed dos line endings
- dos2unix conversion
  (ClickImageExample.problem, RandomLabelExample.problem, SimpleMatching.problem)

<problem>

<startouttext />
Accept an answer of around 90 or -90
<endouttext />

<customresponse answerdisplay="something near 90 or -90">
    <answer type="loncapa/perl">
# We do not want a vector
if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }
# No units needed
if ($submission=~/^\d+\s+\w+$/) { return 'UNIT_NOTNEEDED'; }
# Need a numerical answer here
if ($submission!~/^\d+$/) { return 'WANTED_NUMERIC'; }
$difference=abs(90-abs($submission));
if ($difference==0) { return 'EXACT_ANS'; }
if ($difference < 0.001) { return 'APPROX_ANS'; }
return 'INCORRECT';
    </answer>
    <textline />
</customresponse>

</problem>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>