Rev 7142 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2071 | zjchen | 1 | %% This file is language-independent. |
2 | |||
3 | \text{header=wims(nonempty lines wims(record 0 of \datafile))} |
||
4 | \integer{n=wims(linecnt \header)} |
||
5 | \text{commonq=} |
||
6 | \for{k=1 to \n}{ |
||
7 | \text{l=\header[\k;]} |
||
8 | \text{test=wims(char 1 to 3 of \l)} |
||
9 | \text{l=wims(char 4 to -1 of \l)} |
||
10 | \text{commonq=\test issametext .IQ?\commonq \l} |
||
11 | } |
||
12 | |||
13 | \integer{qcnt=items(\records)} |
||
14 | \integer{givetrue=1} |
||
15 | \integer{minfalse=0} |
||
16 | \text{option=} |
||
17 | \integer{tot=8} |
||
18 | \text{anstype=checkbox iswordof \option?checkbox:radio} |
||
19 | \text{chars=A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z} |
||
20 | |||
21 | \text{ans=} |
||
22 | \text{list=} |
||
23 | \text{pick=} |
||
24 | \text{hint=} |
||
25 | \text{image=} |
||
26 | \text{feedback=} |
||
27 | \text{statement=} |
||
28 | \text{empty=} |
||
29 | \text{Tot=} |
||
30 | |||
31 | \for{rec in \records}{ |
||
32 | |||
33 | \text{data=wims(trim wims(record \rec of \datafile))} |
||
34 | \text{data=wims(embraced randitem \data)} |
||
35 | \text{statement1=wims(line 1 of \data)} |
||
36 | \text{statement1=wims(singlespace wims(rows2lines \statement1))} |
||
37 | \integer{n=wims(linecnt \data)} |
||
38 | \text{true1=} |
||
39 | \text{false1=} |
||
40 | \text{contents=statement} |
||
41 | \text{fb1=} |
||
42 | \for{k=2 to \n}{ |
||
43 | \text{l=wims(trim wims(line \k of \data))} |
||
44 | \text{c=wims(char 1 of \l)} |
||
45 | \text{l=wims(char 2 to -1 of \l)} |
||
46 | \text{l=wims(replace internal , by , in \l)} |
||
47 | \text{l=wims(singlespace wims(rows2lines \l))} |
||
48 | \text{contents=\contents,\l} |
||
49 | \if{\c issametext 0}{ |
||
50 | \text{false1=wims(append item \k to \false1)} |
||
51 | } |
||
52 | \if{\c issametext 1}{ |
||
53 | \text{true1=wims(append item \k to \true1)} |
||
54 | } |
||
55 | \if{\c isin Ff and \k > 2}{ |
||
56 | \text{fb1=\fb1\l} |
||
57 | } |
||
58 | \if{\c isin Hh}{ |
||
59 | \text{hint=\l} |
||
60 | } |
||
61 | \if{\c isin Ii}{ |
||
62 | \text{image=wims(trim \l)} |
||
63 | } |
||
64 | \text{fb1=\fb1,} |
||
65 | } |
||
66 | \integer{truecnt=items(\true1)} |
||
67 | \integer{falsecnt=items(\false1)} |
||
68 | \integer{givetrue1=\givetrue>\truecnt?\truecnt:\givetrue} |
||
69 | \integer{tot1=\tot > \falsecnt+\givetrue?\falsecnt+\givetrue:\tot} |
||
70 | \integer{givetrue1=\givetrue1>\tot1-1?\tot1-1} |
||
71 | \integer{minfalse1=\minfalse>\tot1-\givetrue1?\tot1-\givetrue1:\minfalse} |
||
72 | \text{tsh=shuffle(\truecnt)} |
||
73 | \text{true=item(\tsh,\true1)} |
||
74 | \if{\minfalse1>0}{ |
||
75 | \text{false1=item(1..\minfalse1,\false1);} |
||
76 | \text{false2=item(\minfalse1+1..\falsecnt,\false1)} |
||
77 | }{ |
||
78 | \integer{minfalse1=0} |
||
79 | \text{false2=\false1} |
||
80 | \text{false1=} |
||
81 | } |
||
82 | \text{fsh=shuffle(\falsecnt)} |
||
83 | \text{false2=item(\fsh,\false2)} |
||
84 | \text{pick1=item(1..\givetrue1,\true),\false1 item(1..\tot1-\givetrue1-\minfalse1,\false2)} |
||
85 | \text{ind=wims(makelist 1 for x=1 to \givetrue1),wims(makelist 0 for x=1 to \tot1-\givetrue1)} |
||
86 | \text{sh=shuffle(\tot1)} |
||
87 | \text{ind=item(\sh,\ind)} |
||
88 | \text{pick1=item(\sh,\pick1)} |
||
89 | \text{ans1=positionof(1,\ind)} |
||
90 | \text{list1=item(1..\tot1,\chars)} |
||
91 | \text{Tot=\Tot\tot1,} |
||
92 | \text{list=\list\list1;} |
||
93 | \text{ans=\ans\ans1;} |
||
94 | \text{feedback=\feedback\fb1[\pick1];} |
||
95 | \text{pick1=\contents[\pick1]} |
||
96 | \text{pick=\pick\pick1;} |
||
97 | \text{statement=\statement\statement1;} |
||
98 | |||
99 | } |
||
100 | |||
101 | \text{repind=} |
||
102 | \text{indcolor=} |
||
103 | \text{reps=} |
||
104 | \text{steps=wims(makelist r x for x=1 to \qcnt)} |
||
105 | \text{steps=\steptype notsametext all?wims(items2lines \steps)} |
||
106 | \steps{\steps} |
||
107 | |||
108 | \statement{ |
||
109 | \if{\image notsametext }{ |
||
17235 | bpr | 110 | <img align="right" hspace="10" src="\imagedir/\image" alt=""> <p> |
2071 | zjchen | 111 | } |
112 | \commonq |
||
113 | \for{q=1 to \qcnt}{ |
||
114 | \if{\steptype issametext all or (\status issametext end and \q<=\step) or \q=\step}{ |
||
6084 | bpr | 115 | \if{\qcnt>1}{<div> \q. } |
2071 | zjchen | 116 | \statement[\q;] |
6593 | bpr | 117 | </div><table class="wimsnoborder"> |
2071 | zjchen | 118 | \for{i=1 to \Tot[\q]}{ |
6593 | bpr | 119 | <tr><td class="nowrap">\embed{reply \q,\i}.</td> |
2071 | zjchen | 120 | <td>\pick[\q;\i]</td></tr> |
121 | } |
||
122 | </table> |
||
123 | \if{\status issametext end and \repind[\q]>0 and \feedback[\q;\repind[\q]] notsametext }{ |
||
7141 | bpr | 124 | <p style="color:\indcolor[\q];font-style:italic">\feedback[\q;\repind[\q]]</p> |
2071 | zjchen | 125 | } |
17235 | bpr | 126 | \if{\q<\qcnt and (\steptype issametext all or \q<\step)}{<hr>} |
2071 | zjchen | 127 | } |
128 | } |
||
17235 | bpr | 129 | \if{\image notsametext }{<br style="clear:right;">} |
2071 | zjchen | 130 | } |
131 | |||
132 | \answer{\choicename 1}{\ans[1;];\list[1;]}{type=\anstype}{option=\option} |
||
133 | \answer{\choicename 2}{\ans[2;];\list[2;]}{type=\anstype}{option=\option} |
||
134 | \answer{\choicename 3}{\ans[3;];\list[3;]}{type=\anstype}{option=\option} |
||
135 | \answer{\choicename 4}{\ans[4;];\list[4;]}{type=\anstype}{option=\option} |
||
136 | \answer{\choicename 5}{\ans[5;];\list[5;]}{type=\anstype}{option=\option} |
||
137 | \answer{\choicename 6}{\ans[6;];\list[6;]}{type=\anstype}{option=\option} |
||
138 | \answer{\choicename 7}{\ans[7;];\list[7;]}{type=\anstype}{option=\option} |
||
139 | \answer{\choicename 8}{\ans[8;];\list[8;]}{type=\anstype}{option=\option} |
||
140 | \answer{\choicename 9}{\ans[9;];\list[9;]}{type=\anstype}{option=\option} |
||
141 | \answer{\choicename 10}{\ans[10;];\list[10;]}{type=\anstype}{option=\option} |
||
142 | \answer{\choicename 11}{\ans[11;];\list[11;]}{type=\anstype}{option=\option} |
||
143 | \answer{\choicename 12}{\ans[12;];\list[12;]}{type=\anstype}{option=\option} |
||
144 | \answer{\choicename 13}{\ans[13;];\list[13;]}{type=\anstype}{option=\option} |
||
145 | \answer{\choicename 14}{\ans[14;];\list[14;]}{type=\anstype}{option=\option} |
||
146 | \answer{\choicename 15}{\ans[15;];\list[15;]}{type=\anstype}{option=\option} |
||
147 | \answer{\choicename 16}{\ans[16;];\list[16;]}{type=\anstype}{option=\option} |
||
148 | \answer{\choicename 17}{\ans[17;];\list[17;]}{type=\anstype}{option=\option} |
||
149 | \answer{\choicename 18}{\ans[18;];\list[18;]}{type=\anstype}{option=\option} |
||
150 | \answer{\choicename 19}{\ans[19;];\list[19;]}{type=\anstype}{option=\option} |
||
151 | \answer{\choicename 20}{\ans[20;];\list[20;]}{type=\anstype}{option=\option} |
||
152 | |||
153 | \text{reps=\reply1,\reply2,\reply3,\reply4,\reply5,\reply6,\reply7,\preply8,\preply9,\reply10, |
||
154 | \reply11,\reply12,\reply13,\reply14,\reply15,\reply16,\reply17,\preply8,\preply9,\reply20} |
||
155 | \for{t=1 to \qcnt}{ |
||
156 | \text{ind=positionof(\reps[\t],\chars)} |
||
157 | \text{repind=\repind\ind,} |
||
158 | \text{indcolor=\ind isitemof \ans[\t;]?\indcolor[]green,:\indcolor[]red,} |
||
159 | } |
||
160 | |||
161 | \hint{\hint} |