Rev 5923 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
338 | schaersvoo | 1 | # this file expect the answer to be reply$n and returns a modulescore |
2 | # it just checks a number answer |
||
3 | # examples |
||
4 | # sqrt(2) 1123 |
||
5 | # 234242.234242 2.3e+23 |
||
6 | # 2*10^2323 |
||
7 | # x1=23432 x2=34353653 x3=345353543535 |
||
8 | # if you expect "x=" or "z=" or "y=" in the reply$n , declare arglist=x |
||
9 | # if the answer is 5*x use variable.proc |
||
3629 | schaersvoo | 10 | # complex numbers declare: complex=1 |
11 | # if no real answers/solutions: answer$n=nil |
||
12 | # >>> set var1=yes if the sequence of answers matters |
||
4690 | schaersvoo | 13 | # 3/2010 changed rounding |
14 | # 6/2010 "improved rounding" |
||
15 | # 12/2010 "improved presentation" multiple answers (in html) |
||
16 | # 12/2010 declare var10=10,1000,10000,1,0 ... as list of roundings when using multiple answers |
||
3775 | schaersvoo | 17 | # 2/2011 presentation without <ul> list when single answer |
4690 | schaersvoo | 18 | # 10/2011 if no "arglist" is set, now no "error" when pupils write: V=123 and A=456 B=12 |
19 | # 10/2011 : this file becomes too big: should be rewritten... :( |
||
3308 | schaersvoo | 20 | |
338 | schaersvoo | 21 | goback=0 |
362 | schaersvoo | 22 | errortext=$empty |
338 | schaersvoo | 23 | n=$counter |
3239 | schaersvoo | 24 | !if $(reply$n)=? |
338 | schaersvoo | 25 | remark$n=$NOK |
26 | goback=0 |
||
27 | maxscore=0 |
||
28 | !exit |
||
29 | !endif |
||
30 | |||
31 | test=!lower $(reply$n) |
||
32 | # there is no real solution |
||
33 | nothing=!record 71 of $remarkdir/commonremarks.$taal |
||
34 | #@ nul,zero,zip,nop,niks,nada,geen,niente |
||
35 | A=0 |
||
36 | test=!singlespace $test |
||
37 | !for check in $nothing |
||
38 | !if $A=0 |
||
718 | schaersvoo | 39 | !if $check iswordof $test |
338 | schaersvoo | 40 | A=1 |
41 | !endif |
||
42 | !endif |
||
43 | !next p |
||
44 | |||
45 | !if $(answer$n)=nil |
||
46 | !if $A=1 |
||
47 | remark$n=$OK |
||
48 | maxscore=1 |
||
49 | !increase modulescore |
||
50 | !else |
||
51 | remark$n=$NOK |
||
52 | maxscore=0 |
||
53 | !endif |
||
54 | goback=0 |
||
55 | !exit |
||
56 | !else |
||
57 | !if $A=1 |
||
58 | ex=!record 83 of $remarkdir/commonremarks.$taal |
||
59 | #@ Er zijn wel degelijk oplossingen... |
||
5807 | schaersvoo | 60 | remark$n=$NOK <br />$ex |
338 | schaersvoo | 61 | maxscore=0 |
62 | goback=0 |
||
63 | !exit |
||
64 | !endif |
||
65 | !endif |
||
66 | |||
67 | errortext=$empty |
||
68 | !if $wordmax=$empty |
||
3629 | schaersvoo | 69 | wordmax=20 |
338 | schaersvoo | 70 | !endif |
71 | AAA=!lower $(reply$n) |
||
72 | |||
988 | schaersvoo | 73 | tot=!singlespace $AAA |
74 | |||
338 | schaersvoo | 75 | # first check for the 'decimal' comma |
76 | |||
3345 | schaersvoo | 77 | !if $questiontype notin 0,7,9 |
718 | schaersvoo | 78 | # questiontype=0 uses precheck.js as default answer-filter questiontype=7 is tailored with own js-functions |
338 | schaersvoo | 79 | # checking on decimal comma is already done |
80 | c=!positionof char , in $tot |
||
81 | !if $c != $empty |
||
82 | ta=!itemcnt $(answer$n) |
||
83 | !if $ta>1 |
||
84 | check=1 |
||
85 | !else |
||
86 | check=0 |
||
87 | !endif |
||
88 | nummers=0123456789 |
||
89 | !for i in $c |
||
90 | c1=!char $[$i-1] of $tot |
||
91 | c2=!char $[$i+1] of $tot |
||
92 | !if $c1 isin $nummers and $c2 isin $nummers |
||
93 | !increase check |
||
94 | maxscore=$[$maxscore*$P1] |
||
95 | !if $check >1 |
||
96 | errortext=!record 28 of $remarkdir/commonremarks.$taal |
||
97 | goback=1 |
||
5857 | schaersvoo | 98 | !exit |
338 | schaersvoo | 99 | !else |
100 | # we replace only 1 decimal comma by a point... |
||
101 | tot=!replace internal char number $i by . in $tot |
||
102 | ex=!record 24 of $remarkdir/commonremarks.$taal |
||
103 | !if $extra != $empty |
||
5807 | schaersvoo | 104 | extra=$extra<br />$ex |
338 | schaersvoo | 105 | !else |
106 | extra=$ex |
||
107 | !endif |
||
108 | !endif |
||
109 | !endif |
||
110 | !next i |
||
111 | AAA=$tot |
||
112 | !endif |
||
113 | !endif |
||
3629 | schaersvoo | 114 | |
4690 | schaersvoo | 115 | !for p in -->,==>,->,=> |
116 | AAA=!replace internal $p by = in $AAA |
||
117 | !next p |
||
338 | schaersvoo | 118 | AAA=!replace internal word is by = in $AAA |
119 | AAA=!words2items $AAA |
||
120 | test=!itemcnt $AAA |
||
121 | |||
122 | !if $test > $wordmax |
||
123 | maxscore=$[$maxscore*$P3] |
||
124 | errortext=!record 48 of $remarkdir/commonremarks.$taal |
||
125 | goback=1 |
||
3629 | schaersvoo | 126 | !exit |
338 | schaersvoo | 127 | !endif |
128 | |||
129 | AAA=!nospace $AAA |
||
130 | # pfff |
||
131 | !for p=1 to 3 |
||
132 | AAA=!replace internal ,, by , in $AAA |
||
5923 | schaersvoo | 133 | !next p |
338 | schaersvoo | 134 | c1=!char 1 of $AAA |
135 | c2=!char -1 of $AAA |
||
136 | !if $c1=, |
||
137 | AAA=!char 2 to -1 of $AAA |
||
138 | !endif |
||
139 | !if $c2=, |
||
140 | AAA=!char 1 to -2 of $AAA |
||
141 | !endif |
||
142 | |||
143 | AAA=!nospace $AAA |
||
144 | AAA=!replace internal ** by ^ in $AAA |
||
145 | !if $questiontype != 0 |
||
146 | # questiontyp=0 uses precheck.js as default answer-filter ! |
||
147 | # checking on scientific notation and letter "o" as number "0" is already done |
||
148 | !if x10 isin $AAA |
||
149 | ex=!record 68 of $remarkdir/commonremarks.$taal |
||
150 | maxscore=$[$P1*$maxscore] |
||
151 | !if $teaching=1 |
||
152 | goback=1 |
||
153 | errortext=$ex |
||
154 | !exit |
||
155 | !else |
||
156 | AAA=!replace internal x10 by *10 in $AAA |
||
157 | !if $extra=$empty |
||
158 | extra=$ex |
||
159 | !else |
||
5807 | schaersvoo | 160 | extra=$extra<br />$ex |
338 | schaersvoo | 161 | !endif |
162 | !endif |
||
163 | !endif |
||
164 | test=!replace [0-9]e[0-9] by @ in $AAA |
||
165 | !if @ isin $test |
||
166 | maxscore=$[$P1*$maxscore] |
||
167 | testvar1=!replace internal e by e+ in $AAA |
||
5857 | schaersvoo | 168 | testvar1=<span style="color:green:>$testvar1</span> |
169 | testvar2=<br /><span style="color:red">$AAA</span> |
||
338 | schaersvoo | 170 | errortext=!record 16 of $remarkdir/commonremarks.$taal |
171 | goback=1 |
||
172 | !exit |
||
173 | !endif |
||
174 | AAA=!replace internal e+ by *10^ in $AAA |
||
175 | AAA=!replace internal e- by *10^- in $AAA |
||
176 | !for p=1 to 3 |
||
177 | AAA=!replace internal ** by * in $AAA |
||
178 | !next p |
||
179 | t=!char 1 of $AAA |
||
180 | !if $t=* |
||
181 | AAA=!char 2 to -1 of $AAA |
||
3629 | schaersvoo | 182 | !endif |
338 | schaersvoo | 183 | # check on the letter 'o' as number "0" |
184 | aaa=!nospace $AAA |
||
185 | aaa=!replace internal = by @ in $aaa |
||
186 | t=!positionof char o in $aaa |
||
187 | !if $t != $empty |
||
188 | nummers=0.123456789 |
||
189 | !for p in $t |
||
190 | check=0 |
||
191 | t1=!char $[$p-1] of $aaa |
||
192 | !if $t1=@ |
||
193 | # dus x=o |
||
194 | check=1 |
||
195 | !endif |
||
196 | t2=!char $[$p+1] of $aaa |
||
197 | !if $t1 isin $nummers and $t2 isin $nummers |
||
198 | check=1 |
||
3629 | schaersvoo | 199 | !endif |
338 | schaersvoo | 200 | # dus 123o 123.o |
201 | !if $check=1 |
||
202 | maxscore=$[$P2*$maxscore] |
||
203 | !if $teaching=1 |
||
204 | errortext=!record 13 of $remarkdir/commonremarks.$taal |
||
205 | goback=1 |
||
206 | !exit |
||
207 | !else |
||
208 | ex=!record 48 of $remarkdir/commonremarks.$taal |
||
209 | # we corrigeren o -> 0 ! |
||
210 | aaa=!replace internal char number $p by 0 in $aaa |
||
5807 | schaersvoo | 211 | extra=!append line <br />$ex to $extra |
338 | schaersvoo | 212 | !endif |
213 | !endif |
||
214 | !next p |
||
215 | AAA=$aaa |
||
3629 | schaersvoo | 216 | !endif |
338 | schaersvoo | 217 | !endif |
218 | # checkfor a stray '+' or '-' sign as operator. |
||
219 | # do your own calculations ! |
||
220 | # but an answer like 1+3*sqrt(2) should ofcourse be Ok |
||
221 | # and if $varlist is not empty, we should skip this test anyway |
||
222 | # (3+4x) is a sound answer |
||
223 | !if $varlist = $empty |
||
224 | !if (+ isin $AAA) or (- isin $AAA) |
||
225 | dingen=i,sqrt,cos,tan,abs,log,ln |
||
226 | # 'sin' is covered by 'i' |
||
227 | !for r in $dingen |
||
228 | !if $r isin $AAA |
||
229 | # no need to go on |
||
230 | !goto READY1 |
||
3629 | schaersvoo | 231 | !endif |
338 | schaersvoo | 232 | !next r |
233 | nummers=0,1,2,3,4,5,6,7,8,9 |
||
234 | !for s in +,- |
||
235 | t=!positionof char $s in $AAA |
||
236 | !if $t != $empty |
||
237 | !for p in $t |
||
238 | t1=!char $[$p-1] of $AAA |
||
239 | t2=!char $[$p+1] of $AAA |
||
240 | !if ($t1 isitemof $nummers) and ($t2 isitemof $nummers) |
||
241 | maxscore=$[$P3*$maxscore] |
||
242 | errortext=!record 14 of $remarkdir/commonremarks.$taal |
||
243 | goback=1 |
||
244 | !exit |
||
245 | !endif |
||
246 | !next p |
||
247 | !endif |
||
248 | !next s |
||
6079 | schaersvoo | 249 | !endif |
338 | schaersvoo | 250 | !endif |
251 | |||
252 | :READY1 |
||
253 | |||
254 | !for p in +,-,*,^,/,| |
||
3629 | schaersvoo | 255 | stupid=!nospace , $p , |
338 | schaersvoo | 256 | !if $stupid isin $AAA |
257 | AAA=!replace internal $stupid by $p in $AAA |
||
258 | !endif |
||
259 | !next p |
||
260 | !for p in sqrt,sin,cos,tan,abs,log,ln,+,-,*,^,/,(,| |
||
261 | stupid=!nospace $p , |
||
262 | !if $stupid isin $AAA |
||
263 | AAA=!replace internal $stupid by $p in $AAA |
||
264 | !endif |
||
265 | !next p |
||
266 | !for p in +,*,),^,/ |
||
267 | stupid=!nospace , $p |
||
268 | !if $stupid isin $AAA |
||
269 | AAA=!replace internal $stupid by $p in $AAA |
||
270 | !endif |
||
271 | !next p |
||
272 | |||
273 | #check for sin etc |
||
988 | schaersvoo | 274 | !for i in sqrt,log,sin,ln,cos,tan,abs |
338 | schaersvoo | 275 | !if $i isin $AAA |
276 | # test on balanced |x| |
||
277 | test1=!replace internal $i| by # in $AAA |
||
278 | !if # isin $test1 |
||
279 | # so ln|x| ===> ln(|x|) |
||
280 | # rawmath deals elegantly with |x| => abs(x) |
||
281 | pos=!positionof char | in $AAA |
||
282 | tot=!itemcnt $pos |
||
283 | !if $[gcd($tot,2)] != 2 |
||
284 | maxscore=$[$P1*$maxscore] |
||
285 | # uneven number of |-bars |
||
286 | errortext=!record 15 of $remarkdir/commonremarks.$taal |
||
287 | goback=1 |
||
288 | !exit |
||
289 | !endif |
||
290 | !for r=1 to $[$tot-1] |
||
291 | p1=!item $r of $pos |
||
292 | p2=!item $[$r+1] of $pos |
||
293 | AAA=!replace internal char number $p1 by ~ in $AAA |
||
294 | AAA=!replace internal char number $p2 by # in $AAA |
||
295 | AAA=!replace internal ~ by (| in $AAA |
||
296 | AAA=!replace internal # by |) in $AAA |
||
297 | !next r |
||
298 | !endif |
||
299 | test2=!replace internal $i( by # in $AAA |
||
300 | !if # notin $test2 |
||
301 | testvar1=!nospace $i ( x ) |
||
302 | testvar2=!nospace $i x |
||
303 | maxscore=$[$maxscore*$P2] |
||
304 | errortext=!record 19 of $remarkdir/commonremarks.$taal |
||
305 | goback=1 |
||
306 | !exit |
||
307 | !endif |
||
308 | !if $i=ln |
||
309 | !if LOG isin $AAA |
||
5807 | schaersvoo | 310 | errortext=Het lijkt me sterk dat dit sommetjes zowel een <br /><b>log()</b><br />als een<br /><b>ln()</b><br />in het antwoord moet hebben |
338 | schaersvoo | 311 | maxscore=$[$P4*$maxscore] |
312 | goback=1 |
||
313 | !exit |
||
314 | !endif |
||
315 | AAA=!replace internal ln by LOG in $AAA |
||
316 | !endif |
||
317 | I=!toupper $i |
||
318 | AAA=!replace internal $i by $I in $AAA |
||
319 | !endif |
||
320 | !next i |
||
321 | |||
322 | AAA=!nospace $AAA |
||
323 | #check on "=" sign or "is" |
||
324 | #after that remove x1= x_1= x_23= or a1= a2= a3= b9= ... z2= etc etc from tha studentanswer |
||
325 | test=!replace internal = by @ in $AAA |
||
3629 | schaersvoo | 326 | |
338 | schaersvoo | 327 | !if @ isin $test |
328 | !if $arglist != $empty |
||
3629 | schaersvoo | 329 | use_arg=1 |
338 | schaersvoo | 330 | !for p in $arglist |
4690 | schaersvoo | 331 | P=!lower $p |
332 | AAA=!replace $P[_0-9]* by @ in $AAA |
||
338 | schaersvoo | 333 | !next p |
334 | !if @ notin $AAA |
||
335 | maxscore=$[$P1*$maxscore] |
||
336 | testvar= <b> $arglist =... </b> |
||
337 | errortext=!record 53 of $remarkdir/commonremarks.$taal |
||
338 | goback=1 |
||
339 | !exit |
||
340 | !else |
||
341 | AAA=!replace internal @ by $empty in $AAA |
||
342 | AAA=!replace internal = by $empty in $AAA |
||
343 | # now: ,,en,,3,,en,ook,4 |
||
344 | !endif |
||
345 | !else |
||
3629 | schaersvoo | 346 | use_arg=0 |
4690 | schaersvoo | 347 | new_AAA=$empty |
348 | # strip all a=123,b=4334,c=2344 --> 123,4334,2344 |
||
349 | AAA=!replace internal = by , in $AAA |
||
350 | !for p in $AAA |
||
351 | !if NaN notin $[1*$p] |
||
352 | new_AAA=!append item $p to $new_AAA |
||
353 | !endif |
||
354 | !next p |
||
355 | AAA=$new_AAA |
||
338 | schaersvoo | 356 | !endif |
357 | !else |
||
358 | !if $arglist != $empty |
||
359 | maxscore=$[$P1*$maxscore] |
||
360 | testvar= <b> $arglist =... </b> |
||
361 | errortext=!record 53 of $remarkdir/commonremarks.$taal |
||
362 | goback=1 |
||
363 | !exit |
||
364 | !endif |
||
365 | !endif |
||
4690 | schaersvoo | 366 | |
338 | schaersvoo | 367 | AAA=!nospace $AAA |
368 | # the position of "!rawmath" is critical... |
||
369 | # ATTENTION: rawmath ln(|x|) => ln(abs(x)) |
||
370 | # ATTENTION: rawmath ln|x| => ln(abs)*(x) |
||
371 | AAA=!replace internal pi by PI in $AAA |
||
988 | schaersvoo | 372 | # correcting for x=1 en x=2 |
4690 | schaersvoo | 373 | !for p in en,et,er,euro,euros |
988 | schaersvoo | 374 | AAA=!replace internal $p by $empty in $AAA |
375 | !next p |
||
376 | AAA=!replace internal e by E in $AAA |
||
338 | schaersvoo | 377 | # i -> 10 |
378 | !if $complex=1 |
||
379 | # complex numbers gewoon vervangen door een getal |
||
380 | !if i isin $AAA |
||
381 | AAA=!rawmath $AAA |
||
382 | # we consider both "5i" and "i5" ok-> 5*10* ,*10*5 |
||
383 | AAA=!replace internal i by *10* in $AAA |
||
384 | AAA=!replace internal ** by * in $AAA |
||
385 | AAA=!replace internal (* by ( in $AAA |
||
386 | AAA=!replace internal *) by ) in $AAA |
||
387 | AAA=!replace internal /* by / in $AAA |
||
388 | AAA=!replace internal */ by / in $AAA |
||
389 | AAA=!replace internal -* by - in $AAA |
||
390 | AAA=!replace internal *- by - in $AAA |
||
391 | AAA=!replace internal +* by + in $AAA |
||
392 | AAA=!replace internal *+ by + in $AAA |
||
393 | !endif |
||
394 | GGG=!replace internal pi by PI in $(answer$n) |
||
395 | GGG=!replace internal sin by SIN in $GGG |
||
396 | GGG=!replace internal i by 10 in $GGG |
||
397 | GGG=!lower $GGG |
||
398 | !else |
||
399 | GGG=$(answer$n) |
||
400 | !endif |
||
401 | |||
402 | AAA=!replace internal abs by ABS in $AAA |
||
403 | AAA=!replace [a-z\~\!\@\#\$\=\%\&\_\;] by $empty in $AAA |
||
404 | AAA=!tolower $AAA |
||
3629 | schaersvoo | 405 | AAA=!rawmath $AAA |
406 | AAA=!nospace $AAA |
||
338 | schaersvoo | 407 | |
408 | !for p=1 to 6 |
||
409 | AAA=!replace internal ,, by , in $AAA |
||
410 | !next p |
||
411 | |||
412 | c1=!char 1 of $AAA |
||
413 | !if $c1=, |
||
414 | AAA=!char 2 to -1 of $AAA |
||
415 | !endif |
||
416 | c1=!char -1 of $AAA |
||
417 | !if $c1=, |
||
418 | AAA=!char 1 to -2 of $AAA |
||
419 | !endif |
||
420 | |||
3629 | schaersvoo | 421 | ta=!itemcnt $AAA |
422 | tg=!itemcnt $GGG |
||
4690 | schaersvoo | 423 | |
3629 | schaersvoo | 424 | !if $ta=0 |
338 | schaersvoo | 425 | maxscore=$[$P5*$maxscore] |
426 | goback=1 |
||
427 | errortext=!record 36 of $remarkdir/commonremarks.$taal |
||
428 | !exit |
||
429 | !endif |
||
430 | |||
431 | tot=$empty |
||
432 | AAA=!nospace $AAA |
||
3629 | schaersvoo | 433 | !for p=1 to $ta |
338 | schaersvoo | 434 | A=!item $p of $AAA |
3239 | schaersvoo | 435 | !if ? isin $A |
436 | A=123456789 |
||
437 | !else |
||
438 | a=!char -1 of $A |
||
439 | !if $a=* |
||
440 | A=!char 1 to -2 of $A |
||
3629 | schaersvoo | 441 | !endif |
3239 | schaersvoo | 442 | a=!char 1 of $A |
443 | !if $a=* |
||
444 | A=!char 2 to -1 of $A |
||
3629 | schaersvoo | 445 | !endif |
3239 | schaersvoo | 446 | !if NaN isin $[1*($A)] and $complex!=1 |
447 | # test op sqrt(-4) |
||
448 | !if (sqrt isin $A) or (log isin $A) or (ln isin $A) |
||
449 | test=!replace internal sqrt( by @ in $A |
||
450 | test=!replace internal log( by @ in $test |
||
451 | test=!replace internal ln( by @ in $test |
||
452 | p1=!positionof char @ in $test |
||
453 | p2=!positionof char ) in $test |
||
454 | h=!itemcnt $p2 |
||
455 | k=!itemcnt $p1 |
||
456 | chars=$empty |
||
457 | !if $h=1 and $k=1 |
||
458 | !for s=$[$p1+1] to $[$p2-1] |
||
459 | ch=!char $s of $test |
||
460 | chars=!append word $ch to $chars |
||
461 | !next s |
||
338 | schaersvoo | 462 | !else |
3239 | schaersvoo | 463 | klaar=0 |
464 | !if $k=1 |
||
465 | !for w in $p2 |
||
5807 | schaersvoo | 466 | kkk=!append line w=$w<br /> to $kkk |
3239 | schaersvoo | 467 | !if $w>$p1 and $klaar=0 |
468 | !for s=$[$p1+1] to $[$w-1] |
||
469 | ch=!char $s of $test |
||
470 | chars=!append word $ch to $chars |
||
471 | !next s |
||
472 | klaar=1 |
||
473 | !endif |
||
474 | !next w |
||
475 | !else |
||
476 | # meerdere sqrt's in 1 antwoord... wordt erg onwaarschijnlijk en niet echt interessant |
||
477 | chars=1 |
||
478 | !endif |
||
338 | schaersvoo | 479 | !endif |
3239 | schaersvoo | 480 | chars=!nospace $chars |
481 | testvar=$[1*$chars] |
||
338 | schaersvoo | 482 | |
3239 | schaersvoo | 483 | !ifval $testvar<0 |
484 | # hehe negatieve wortel |
||
485 | errortext=!record 88 of $remarkdir/commonremarks.$taal |
||
486 | !else |
||
487 | errortext=!record 26 of $remarkdir/commonremarks.$taal |
||
488 | !endif |
||
489 | !else |
||
338 | schaersvoo | 490 | errortext=!record 26 of $remarkdir/commonremarks.$taal |
491 | !endif |
||
3239 | schaersvoo | 492 | maxscore=$[$P5*$maxscore] |
493 | goback=1 |
||
494 | !exit |
||
338 | schaersvoo | 495 | !endif |
496 | !endif |
||
497 | tot=!append item $A to $tot |
||
498 | !next p |
||
499 | |||
500 | AAA=$tot |
||
501 | |||
3629 | schaersvoo | 502 | !if $ta != $tg |
503 | !if $ta>$tg |
||
504 | maxscore=$[$P7*$maxscore*$tg/$ta] |
||
338 | schaersvoo | 505 | !else |
3629 | schaersvoo | 506 | maxscore=$[$P5*$maxscore*$ta/$tg] |
507 | !endif |
||
508 | testvar2=$ta |
||
509 | testvar1=$tg |
||
338 | schaersvoo | 510 | ex=!record 50 of $remarkdir/commonremarks.$taal |
5807 | schaersvoo | 511 | extra=!append line <br />$ex to $extra |
338 | schaersvoo | 512 | !endif |
513 | |||
3629 | schaersvoo | 514 | afr1=$empty |
515 | afr2=$empty |
||
516 | !if $var10 != $empty |
||
517 | # tg=!itemcnt GGG |
||
518 | multiple_roundings=1 |
||
519 | t3=!itemcnt $var10 |
||
520 | !if $t3 != $tg |
||
521 | errortext=error in module : var10 should be used for a list of rounding factors (var10= $var10) |
||
522 | goback=1 |
||
523 | !exit |
||
524 | !endif |
||
525 | !for p=1 to $t3 |
||
526 | a=!item $p of $var10 |
||
527 | !if $a<1 |
||
528 | !if $a=-1 |
||
529 | #not given |
||
530 | afr1=!append item 1000 to $afr1 |
||
531 | afr2=!append item 100 to $afr2 |
||
532 | !else |
||
533 | #exact |
||
534 | afr1=!append item 1000000 to $afr1 |
||
535 | afr2=!append item 10000 to $afr2 |
||
536 | !endif |
||
537 | !else |
||
538 | afr1=!append item $a to $afr1 |
||
539 | afr2=!append item $[$a/10] to $afr2 |
||
540 | !endif |
||
541 | !next p |
||
338 | schaersvoo | 542 | !else |
3629 | schaersvoo | 543 | multiple_roundings=0 |
544 | !for p=1 to $tg |
||
545 | !if $rounding<1 |
||
546 | !if $rounding=-1 |
||
547 | #not given |
||
548 | afr1=!append item 1000 to $afr1 |
||
549 | afr2=!append item 100 to $afr2 |
||
550 | !else |
||
551 | #exact |
||
552 | afr1=!append item 1000000 to $afr1 |
||
553 | afr2=!append item 10000 to $afr2 |
||
554 | !endif |
||
555 | !else |
||
556 | afr1=!append item $rounding to $afr1 |
||
557 | afr2=!append item $[$rounding/10] to $afr2 |
||
558 | !endif |
||
559 | !next p |
||
338 | schaersvoo | 560 | !endif |
561 | |||
562 | G0=$empty |
||
563 | G1=$empty |
||
564 | G2=$empty |
||
565 | A0=$empty |
||
566 | A1=$empty |
||
567 | A2=$empty |
||
5923 | schaersvoo | 568 | A3=$empty |
3629 | schaersvoo | 569 | !for p=1 to $tg |
338 | schaersvoo | 570 | g=!item $p of $GGG |
3629 | schaersvoo | 571 | ar1=!item $p of $afr1 |
572 | ar2=!item $p of $afr2 |
||
573 | g1=$[(round($ar1*($g)))/$ar1] |
||
574 | g2=$[(round($ar2*($g)))/$ar1] |
||
718 | schaersvoo | 575 | G0=!append item $g to $G0 |
576 | G1=!append item $g1 to $G1 |
||
577 | G2=!append item $g2 to $G2 |
||
338 | schaersvoo | 578 | !next p |
579 | |||
3629 | schaersvoo | 580 | !for p=1 to $ta |
338 | schaersvoo | 581 | a=!item $p of $AAA |
3629 | schaersvoo | 582 | ar1=!item $p of $afr1 |
583 | ar2=!item $p of $afr2 |
||
584 | !if $ar1=$empty |
||
585 | # more pupil replies then expected...use last rounding values |
||
586 | ar1=!item -1 of $afr1 |
||
587 | ar2=!item -1 of $afr2 |
||
588 | !endif |
||
589 | a1=$[(round($ar1*($a)))/$ar1] |
||
590 | a2=$[(round($ar2*($a)))/$ar1] |
||
718 | schaersvoo | 591 | A0=!append item $a to $A0 |
592 | A1=!append item $a1 to $A1 |
||
593 | A2=!append item $a2 to $A2 |
||
5923 | schaersvoo | 594 | # 5/11/2012 |
595 | # we maken een lijst om -0,0,sqrt(0),-sqrt(0) als antwoorden af te vangen |
||
596 | A3=!append item $[1*($a)] to $A3 |
||
338 | schaersvoo | 597 | !next p |
598 | |||
599 | !if NaN isin $A0,$A1,$A2 |
||
600 | maxscore=$[$P3*$maxscore] |
||
601 | goback=1 |
||
602 | errortext=!record 26 of $remarkdir/commonremarks.$taal |
||
603 | !endif |
||
604 | |||
605 | parivraag0=$empty |
||
606 | parivraag1=$empty |
||
607 | parivraag2=$empty |
||
3629 | schaersvoo | 608 | reversed=0 |
609 | |||
610 | |||
338 | schaersvoo | 611 | !if $var1=yes |
612 | # sequence matters : item 1 of $GGG == item 1 of $AAA |
||
3629 | schaersvoo | 613 | # there are $tg inputs/questions |
614 | !for p=1 to $tg |
||
338 | schaersvoo | 615 | a0=!item $p of $A0 |
616 | !if $a0 != $empty |
||
617 | a1=!item $p of $A1 |
||
618 | a2=!item $p of $A2 |
||
619 | g0=!item $p of $G0 |
||
620 | g1=!item $p of $G1 |
||
621 | g2=!item $p of $G2 |
||
3629 | schaersvoo | 622 | rev=$[-1*$a1] |
623 | !if $rev notitemof $A1 |
||
624 | !ifval $a1 != 0 and $rev=$g1 |
||
625 | !increase reversed |
||
626 | !endif |
||
338 | schaersvoo | 627 | !endif |
1094 | schaersvoo | 628 | # 1.0* ivm paribug grote getallen: if( abs(1.234*10^45 - 1.234*10^45) <10^-15,1,0) == 0 |
3629 | schaersvoo | 629 | parivraag0=!append line if( abs(1.0*($g0) - 1.0*($a0)) <= 1.0*10^(-15) ,1,0 ) to $parivraag0 |
630 | parivraag1=!append line if( abs(($g1) - ($a1)) <= 1.0*10^(-15) ,1,0 ) to $parivraag1 |
||
631 | parivraag2=!append line if( abs(($g2) - ($a2)) <= 1.0*10^(-15) ,1,0 ) to $parivraag2 |
||
338 | schaersvoo | 632 | !else |
633 | parivraag0=!append line if(1==0,1,0) to $parivraag0 |
||
634 | parivraag1=!append line if(1==0,1,0) to $parivraag1 |
||
3629 | schaersvoo | 635 | parivraag2=!append line if(1==0,1,0) to $parivraag2 |
338 | schaersvoo | 636 | !endif |
637 | !next p |
||
3629 | schaersvoo | 638 | mx=$tg |
639 | stap=1 |
||
2577 | schaersvoo | 640 | !else |
3629 | schaersvoo | 641 | # one inputfield/question but multiple answers possible in textarea |
642 | # sequence in reply does not matter |
||
643 | # x=10 and x=100 == x=100 and x=10 |
||
644 | # so check for doublures |
||
5923 | schaersvoo | 645 | # A3 5/11/2012 |
646 | check_uniq=!listuniq $A3 |
||
647 | #check_uniq=!listuniq $A0 |
||
3629 | schaersvoo | 648 | tchk=!itemcnt $check_uniq |
649 | !if $ta>$tchk |
||
650 | testvar=$[$ta - $tchk] |
||
651 | ex=!record 51 of $remarkdir/commonremarks.$taal |
||
5807 | schaersvoo | 652 | extra=!append line <br />$ex to $extra |
3629 | schaersvoo | 653 | maxscore=$[$maxscore*$tchk/$ta] |
654 | A0=$check_uniq |
||
655 | A1=!listuniq $A1 |
||
656 | A2=!listuniq $A2 |
||
657 | ta=!itemcnt $A0 |
||
658 | !endif |
||
659 | |||
660 | !for s=1 to $ta |
||
2577 | schaersvoo | 661 | a0=!item $s of $A0 |
662 | a1=!item $s of $A1 |
||
663 | a2=!item $s of $A2 |
||
3629 | schaersvoo | 664 | rev=$[-1*$a1] |
665 | !if $rev notitemof $A1 |
||
666 | !if $rev isitemof $G1 |
||
667 | !increase reversed |
||
718 | schaersvoo | 668 | !endif |
3629 | schaersvoo | 669 | !endif |
670 | !for p=1 to $tg |
||
671 | g0=!item $p of $G0 |
||
672 | g1=!item $p of $G1 |
||
673 | g2=!item $p of $G2 |
||
674 | # 1.0* ivm paribug grote getallen: if( abs(1.234*10^45 - 1.234*10^45) <10^-15,1,0) == 0 |
||
675 | parivraag0=!append line if( abs(1.0*($g0) - 1.0*($a0)) <= 1.0*10^(-15) ,1,0 ) to $parivraag0 |
||
676 | parivraag1=!append line if( abs(($g1) - ($a1)) <= 1.0*10^(-15) ,1,0 ) to $parivraag1 |
||
677 | parivraag2=!append line if( abs(($g2) - ($a2)) <= 1.0*10^(-15) ,1,0 ) to $parivraag2 |
||
2577 | schaersvoo | 678 | !next p |
679 | !next s |
||
3629 | schaersvoo | 680 | mx=$[$tg*$ta] |
681 | stap=$tg |
||
2577 | schaersvoo | 682 | !endif |
338 | schaersvoo | 683 | |
684 | dryrun=!exec pari if(log(5)/log(2)==log(5)/log(2),1,0) |
||
3629 | schaersvoo | 685 | # i.v.m. precision "bug" pari/gp 2.2.10 (chroot version) |
338 | schaersvoo | 686 | tot0=!exec pari $parivraag0 |
687 | tot1=!exec pari $parivraag1 |
||
688 | tot2=!exec pari $parivraag2 |
||
3629 | schaersvoo | 689 | tot0=!lines2items $tot0 |
690 | tot1=!lines2items $tot1 |
||
691 | tot2=!lines2items $tot2 |
||
5923 | schaersvoo | 692 | |
338 | schaersvoo | 693 | !if $wims_exec_error != $empty |
694 | maxscore=$[$P4*$maxscore] |
||
695 | goback=1 |
||
696 | errortext=!record 26 of $remarkdir/commonremarks.$taal |
||
697 | !exit |
||
698 | !endif |
||
3629 | schaersvoo | 699 | |
700 | |||
701 | !if $use_arg=1 |
||
702 | arg= <em>$arglist</em> = |
||
703 | !else |
||
704 | arg=$empty |
||
705 | !endif |
||
706 | |||
707 | score=0 |
||
708 | score0=0 |
||
709 | score1=0 |
||
710 | score2=0 |
||
3775 | schaersvoo | 711 | !if $ta>1 |
712 | rep=<ul> |
||
713 | !else |
||
714 | rep=$empty |
||
715 | !endif |
||
3629 | schaersvoo | 716 | |
717 | c=1 |
||
718 | i=1 |
||
719 | !for p=1 to $mx step $stap |
||
720 | a=!item $i of $A0 |
||
721 | sum0=0 |
||
722 | sum1=0 |
||
723 | sum2=0 |
||
724 | !for s=$c to $[$c+$stap-1] |
||
725 | s1=!item $s of $tot0 |
||
726 | sum0=$[$sum0+$s1] |
||
727 | s1=!item $s of $tot1 |
||
728 | sum1=$[$sum1+$s1] |
||
729 | s1=!item $s of $tot2 |
||
730 | sum2=$[$sum2+$s1] |
||
731 | !next s |
||
732 | c=$[$c+$stap] |
||
733 | !if $sum0=1 |
||
734 | !increase score0 |
||
735 | !increase score1 |
||
736 | !increase score2 |
||
737 | k=#00b800 |
||
738 | !else |
||
739 | !if $sum1=1 |
||
740 | !increase score1 |
||
741 | !increase score2 |
||
742 | k=#009300 |
||
743 | !else |
||
744 | !if $sum2=1 |
||
745 | k=#e89300 |
||
746 | !increase score2 |
||
747 | !else |
||
748 | k=#ff0000 |
||
749 | !endif |
||
750 | !endif |
||
5923 | schaersvoo | 751 | !endif |
3629 | schaersvoo | 752 | !increase i |
3775 | schaersvoo | 753 | !if $ta>1 |
5857 | schaersvoo | 754 | rep=!append line <li><span style="color:$k">$arg<b>$a</b></span></li> to $rep |
3775 | schaersvoo | 755 | !else |
5857 | schaersvoo | 756 | rep=<span style="color:$k">$arg<b>$a</b></span> |
3775 | schaersvoo | 757 | !endif |
3629 | schaersvoo | 758 | !next p |
759 | |||
760 | !if $multiple_roundings=0 |
||
761 | !if $rounding < 1 |
||
762 | score=$score0 |
||
763 | !if $score = 0 |
||
764 | !if $score1 = $mx or $score2 = $mx |
||
765 | score =$[$mx/3] |
||
766 | ex=!record 66 of $remarkdir/commonremarks.$taal |
||
5807 | schaersvoo | 767 | extra=!append line <br />$ex to $extra |
3629 | schaersvoo | 768 | !endif |
769 | !endif |
||
770 | !else |
||
771 | !if $score2>$score1 |
||
772 | ex=!record 29 of $remarkdir/commonremarks.$taal |
||
5807 | schaersvoo | 773 | extra=!append line <br />$ex to $extra |
2838 | schaersvoo | 774 | !endif |
3629 | schaersvoo | 775 | score=$[(2*$score1+$score2)/3] |
2838 | schaersvoo | 776 | !endif |
3629 | schaersvoo | 777 | !else |
778 | score=$[(2*$score1 + $score2)/3] |
||
338 | schaersvoo | 779 | !endif |
780 | |||
3629 | schaersvoo | 781 | !if $reversed>0 |
782 | ex=!record 27 of $remarkdir/commonremarks.$taal |
||
5807 | schaersvoo | 783 | extra=!append line $ <br />$ex $ to $extra |
3629 | schaersvoo | 784 | score=$[$score + $P7*$reversed] |
338 | schaersvoo | 785 | !endif |
786 | |||
3629 | schaersvoo | 787 | maxscore=$[$maxscore*$score/$tg] |
837 | schaersvoo | 788 | modulescore=$[$modulescore + $maxscore] |
789 | |||
3629 | schaersvoo | 790 | |
791 | !if $maxscore>0.9 |
||
338 | schaersvoo | 792 | remark$n=$OK |
793 | !else |
||
1094 | schaersvoo | 794 | !if $maxscore >0.45 |
338 | schaersvoo | 795 | remark$n=$BOK |
796 | !else |
||
797 | remark$n=$NOK |
||
798 | !endif |
||
3629 | schaersvoo | 799 | !endif |
800 | # no !insmath : using html-list and colours. |
||
801 | math=0 |
||
3775 | schaersvoo | 802 | |
803 | !if $ta>1 |
||
3629 | schaersvoo | 804 | reply$n=!append word </ul> to $rep |
3775 | schaersvoo | 805 | !else |
806 | reply$n=$rep |
||
807 | !endif |
||
338 | schaersvoo | 808 | |
809 | !if $extra != $empty |
||
5807 | schaersvoo | 810 | remark$n=!append line $ <br />$extra $ to $(remark$n) |
338 | schaersvoo | 811 | !endif |
812 | |||
3629 | schaersvoo | 813 | goback=0 |
814 | |||
338 | schaersvoo | 815 | !exit |