Rev 11319 | Rev 12169 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11375 | bpr | 1 | type=classify |
23 | reyssat | 2 | textarea="data" |
3 | |||
4 | :Classer les objets selon leurs propriétés, glisser-déposer. |
||
5 | |||
6 | On présente une liste d'objets, et il faut les classer selon leurs |
||
7 | propriétés, en les tirant vers les cases prévues avec la souris. |
||
8 | <p> |
||
9 | Pour construire un exercice avec ce modèle, il suffit d'entrer la liste |
||
10 | d'objets et leurs propriétés. |
||
11 | <p> |
||
12 | Avec une petite modification, une variante de ce modèle peut accepter des |
||
5272 | bpr | 13 | images comme objets. |
5131 | bpr | 14 | $image_help |
23 | reyssat | 15 | <p> |
8002 | bpr | 16 | Auteur du modèle : Gang Xiao <qualite@wimsedu.info> |
23 | reyssat | 17 | |
18 | :%%%%%%%%%%%%%%%%% ATTENTION %%%%%%%%%%%%%%%%%%%% |
||
19 | |||
2880 | bpr | 20 | Enlevez l'en-tête ci-dessus si vous détruisez les balises pour le modèle ! |
23 | reyssat | 21 | (Ce sont les lignes qui commencent par un ':'.) |
22 | Sinon l'exercice risque de ne pas pouvoir repasser sous Createxo. |
||
23 | |||
24 | :%%%%%%%% Paramètres d'exemples à redéfinir %%%%%%%%%%%%%%%%% |
||
25 | |||
26 | :\title{Classer par propriété} |
||
5147 | bpr | 27 | :\author{XIAO, Gang} |
8002 | bpr | 28 | :\email{qualite@wimsedu.info} |
7137 | bpr | 29 | :\credits{} |
23 | reyssat | 30 | |
31 | :Nombre d'objets à classer par exercice. Jusqu'à 20. |
||
32 | \integer{tot=8} |
||
33 | |||
34 | : Le nombre maximal d'objets présentés ayant une même propriété. |
||
35 | Ce nombre doit être strictement plus grand que 1. |
||
36 | \integer{max1=4} |
||
37 | |||
4744 | bpr | 38 | : Le nombre de propriétés à présenter (par défaut le nombre de propriétés) |
39 | Si le nombre de propriétés est strictement inférieur au nombre de propriétés, |
||
40 | un distracteur sera choisi parmi les propriétés non tirées. |
||
41 | \text{prop_cnt=} |
||
42 | |||
23 | reyssat | 43 | :La taille des objets à glisser, en pixels, x fois y. |
44 | Pensez aux gens qui augmentent la taille de polices de leurs navigateurs ! |
||
45 | Ne mettez pas les cases trop petites. |
||
46 | \text{size1=100x40} |
||
47 | |||
48 | :Liste de propriétés. Jusqu'à 10, séparées par des virgules. |
||
49 | \text{prop=Insecte,Oiseau,Mammifère} |
||
50 | |||
51 | :Données principales. |
||
52 | Définir un objet par ligne, d'abord le nom, |
||
53 | ensuite la propriété, séparés par une virgule. <p> |
||
54 | Il vaut mieux définir des données en quantité abondante pour chaque |
||
11319 | bpr | 55 | catégorie et au minimum deux objets pour chaque catégorie.</p><p> |
23 | reyssat | 56 | Attention à ne pas introduire d'erreurs de frappe dans les propriétés ! |
11319 | bpr | 57 | Sinon l'objet correspondant peut causer des dysfonctionnements de l'exercice.</p> |
23 | reyssat | 58 | \matrix{data= |
11319 | bpr | 59 | L'abeille,Insecte |
23 | reyssat | 60 | L'aigle,Oiseau |
61 | L'albatros,Oiseau |
||
62 | L'alouette,Oiseau |
||
63 | La blatte,Insecte |
||
64 | Le canard,Oiseau |
||
65 | Le chat,Mammifère |
||
66 | Le cheval,Mammifère |
||
67 | Le chien,Mammifère |
||
68 | Le cochon,Mammifère |
||
69 | Le corbeau,Oiseau |
||
70 | Le criquet,Insecte |
||
71 | L'éléphant,Mammifère |
||
72 | Le faucon,Oiseau |
||
73 | Le goéland,Oiseau |
||
74 | La guêpe,Insecte |
||
75 | Le lion,Mammifère |
||
76 | Le moineau,Oiseau |
||
77 | La mouche,Insecte |
||
78 | Le moustique,Insecte |
||
79 | Le mouton,Mammifère |
||
80 | L'oie,Oiseau |
||
81 | Le papillon,Insecte |
||
82 | Le pigeon,Oiseau |
||
83 | Le renard,Mammifère |
||
84 | Le rossignol,Oiseau |
||
85 | Le scorpion,Insecte |
||
86 | Le singe,Mammifère |
||
87 | Le tigre,Mammifère |
||
88 | La vache,Mammifère |
||
89 | Le vautour,Oiseau |
||
90 | } |
||
91 | |||
92 | :Mots d'option. |
||
11319 | bpr | 93 | Ajouter <ul><li> le mot <span class="wims_code_words">shuffle</span> si on veut que l'ordre des propriétés soit |
94 | aléatoire, </li><li>le mot <span class="wims_code_words">vertical</li> |
||
95 | si vous voulez une disposition verticale des champs. |
||
96 | </li></ul> |
||
23 | reyssat | 97 | \text{option=} |
98 | |||
99 | :Texte avant le tableau. Balises html admises. |
||
7137 | bpr | 100 | \text{pre=Classez les animaux ci-dessous selon leurs catégories.} |
23 | reyssat | 101 | |
102 | :Texte après le tableau. Balises html admises. |
||
103 | \text{post=} |
||
104 | |||
105 | :Verbe et article à afficher devant la catégorie classée. |
||
106 | \text{estun=est un} |
||
107 | |||
108 | :Comment dire si un objet n'est pas classé ? |
||
109 | \text{noclass=n'appartient à aucune catégorie} |
||
110 | |||
111 | :%%%%%%%%%%%%%% Rien à modifier avant l'énoncé %%%%%%%%%%%%%%%% |
||
112 | |||
113 | \integer{pcnt=items(\prop)} |
||
4744 | bpr | 114 | \integer{prop_cnt=\prop_cnt=? \pcnt} |
115 | \integer{prop_cnt=min(\prop_cnt,\pcnt)} |
||
23 | reyssat | 116 | \integer{datacnt=rows(\data)} |
117 | \integer{max2=\max1+1} |
||
118 | \integer{tot=\tot<\pcnt?\pcnt} |
||
119 | \text{prop=\pcnt>1 and shuffle iswordof \option?shuffle(\prop)} |
||
120 | |||
121 | \text{first=} |
||
122 | \text{firsti=} |
||
123 | \text{second=} |
||
124 | \text{secondi=} |
||
4744 | bpr | 125 | \text{dist=} |
126 | \text{disti=} |
||
127 | \for{i=1 to \prop_cnt}{ |
||
23 | reyssat | 128 | \text{t=shuffle(column(1,wims(select \data where column 2 issametext \prop[\i])))} |
129 | \integer{s=min(\max1,items(\t))} |
||
130 | \text{first=wims(append item \t[1] to \first)} |
||
131 | \text{firsti=wims(append item \i to \firsti)} |
||
132 | \if{\s > 1}{ |
||
133 | \text{second=wims(append item \t[2..\s] to \second)} |
||
134 | \text{secondi=wims(append item wims(makelist \i for x=2 to \s) to \secondi)} |
||
135 | } |
||
136 | } |
||
4744 | bpr | 137 | distracteur |
138 | \if{\prop_cnt<\pcnt}{ |
||
139 | \text{t=shuffle(column(1,wims(select \data where column 2 issametext \prop[\prop_cnt+1])))} |
||
140 | \integer{s=min(\max1,items(\t))} |
||
141 | \text{dist=wims(append item \t[1] to \dist)} |
||
142 | \text{disti=wims(append item \i to \disti)} |
||
143 | } |
||
23 | reyssat | 144 | |
4744 | bpr | 145 | \if{\tot>\prop_cnt}{ |
23 | reyssat | 146 | \integer{scnt=items(\second)} |
4744 | bpr | 147 | \integer{secnt=min(\tot-\prop_cnt,\scnt)} |
148 | \integer{tot=\prop_cnt+\secnt} |
||
23 | reyssat | 149 | \text{sh2=shuffle(\scnt)} |
150 | \text{sh2=\sh2[1..\secnt]} |
||
151 | \text{second=item(\sh2,\second)} |
||
152 | \text{secondi=item(\sh2,\secondi)} |
||
153 | \text{all=\first,\second} |
||
154 | \text{alli=\firsti,\secondi} |
||
155 | }{ |
||
156 | \text{all=\first} |
||
157 | \text{alli=\firsti} |
||
158 | } |
||
5272 | bpr | 159 | \text{all=wims(nonempty items \all)} |
160 | \text{all=wims(listuniq \all)} |
||
23 | reyssat | 161 | \integer{acnt=items(\all)} |
162 | \text{sh=shuffle(\acnt)} |
||
163 | \text{all=item(\sh,\all)} |
||
164 | \text{alli=item(\sh,\alli)} |
||
4744 | bpr | 165 | \text{prop=\prop[1..\prop_cnt]} |
23 | reyssat | 166 | \text{props=wims(tolower \prop)} |
167 | \text{alls=wims(tolower \all)} |
||
168 | \text{size=\size1 x \max2} |
||
11319 | bpr | 169 | \text{sizev=\size x \max2} |
4744 | bpr | 170 | \text{rep=item(1..\prop_cnt,wims(makelist r x for x=1 to 10))} |
23 | reyssat | 171 | \steps{\rep} |
5272 | bpr | 172 | \integer{distc=\dist!= ? 1 : 0} |
173 | \conditions{wims(makelist x for x=1 to \acnt + \distc)} |
||
23 | reyssat | 174 | :%%%%%%%%%%%%% Maintenant l'énoncé en code html. %%%%%%%%%%%%%%%%%%%% |
175 | |||
11319 | bpr | 176 | ::La commande pour afficher le champ de réponse numéro 3 par exemple, |
23 | reyssat | 177 | c'est \embed{reply 3,\size} <p> |
178 | Et le nom de la propriété numéro 4, c'est \prop[4] avec la première lettre |
||
179 | en majuscule, ou \props[4] tout en minuscule. |
||
180 | |||
7137 | bpr | 181 | \statement{<div class="instruction"> |
182 | \pre |
||
183 | </div> |
||
184 | <table class="wimsnoborder"> |
||
11319 | bpr | 185 | \if{vertical iswordof \option}{ |
186 | <tr>\for{k=1 to \prop_cnt}{<th>\prop[\k]</th>}</tr> |
||
187 | <tr>\for{k=1 to \prop_cnt}{ |
||
188 | <td style="text-align:left;vertical-align:top">\embed{reply \k, \sizev}</td>} |
||
189 | </tr> |
||
190 | }{ |
||
191 | \for{k=1 to \prop_cnt}{ |
||
192 | <tr> |
||
193 | <th>\prop[\k]</th> |
||
194 | <td style="text-align:left">\embed{reply \k, \size}</td> |
||
195 | </tr> |
||
196 | } |
||
197 | } |
||
198 | </table> |
||
199 | \post |
||
23 | reyssat | 200 | } |
201 | |||
202 | :%%%%%%%%%%%%% Rien à modifier ci-après. %%%%%%%%%%%%%%%%%5 |
||
203 | |||
7137 | bpr | 204 | \answer{\prop[1]}{\r1;\all,\dist}{type=dragfill} |
23 | reyssat | 205 | \answer{\prop[2]}{\r2}{type=dragfill} |
206 | \answer{\prop[3]}{\r3}{type=dragfill} |
||
207 | \answer{\prop[4]}{\r4}{type=dragfill} |
||
208 | \answer{\prop[5]}{\r5}{type=dragfill} |
||
209 | \answer{\prop[6]}{\r6}{type=dragfill} |
||
210 | \answer{\prop[7]}{\r7}{type=dragfill} |
||
211 | \answer{\prop[8]}{\r8}{type=dragfill} |
||
212 | \answer{\prop[9]}{\r9}{type=dragfill} |
||
213 | \answer{\prop[10]}{\r10}{type=dragfill} |
||
214 | |||
4744 | bpr | 215 | \text{totans=item(1..\prop_cnt, |
23 | reyssat | 216 | wims(items2words \r1), |
217 | wims(items2words \r2), |
||
218 | wims(items2words \r3), |
||
219 | wims(items2words \r4), |
||
220 | wims(items2words \r5), |
||
221 | wims(items2words \r6), |
||
222 | wims(items2words \r7), |
||
223 | wims(items2words \r8), |
||
224 | wims(items2words \r9), |
||
225 | wims(items2words \r10))} |
||
226 | text{totans=wims(replace internal ' to ' in \totans)} |
||
227 | \text{clean=} |
||
228 | \text{check=} |
||
4744 | bpr | 229 | \for{t=1 to \acnt}{ |
23 | reyssat | 230 | \integer{cat=0} |
4744 | bpr | 231 | \for{r=1 to \prop_cnt}{ |
23 | reyssat | 232 | \integer{cat=\all[\t] iswordof \totans[\r]?\r} |
233 | } |
||
234 | \if{\cat > 0}{ |
||
235 | \text{clean=\clean \estun \props[\cat],} |
||
236 | \text{check=\alli[\t]=\cat?\check 1,:\check 0,} |
||
237 | }{ |
||
238 | \text{clean=\clean \noclass,} |
||
239 | \text{check=\check 0,} |
||
240 | } |
||
241 | } |
||
7137 | bpr | 242 | |
5272 | bpr | 243 | \if{\dist!=}{ |
244 | \for{t=1 to 1}{ |
||
7137 | bpr | 245 | \integer{cat=0} |
246 | \for{r=1 to \prop_cnt}{ |
||
247 | \integer{cat=\dist[\t] iswordof \totans[\r]?\r} |
||
248 | } |
||
249 | \if{\cat = 0}{ |
||
5272 | bpr | 250 | \text{clean=\clean \dist[\t] \noclass,} |
251 | \text{check=\check 1,} |
||
252 | }{ |
||
7137 | bpr | 253 | \text{clean=\clean \dist[\t] \estun \props[\cat],} |
5272 | bpr | 254 | \text{check=\check 0,} |
255 | } |
||
4744 | bpr | 256 | } |
257 | } |
||
23 | reyssat | 258 | |
259 | \condition{\all[1] \clean[1]}{\check[1]=1} |
||
260 | \condition{\all[2] \clean[2]}{\check[2]=1} |
||
261 | \condition{\all[3] \clean[3]}{\check[3]=1} |
||
262 | \condition{\all[4] \clean[4]}{\check[4]=1} |
||
263 | \condition{\all[5] \clean[5]}{\check[5]=1} |
||
264 | \condition{\all[6] \clean[6]}{\check[6]=1} |
||
265 | \condition{\all[7] \clean[7]}{\check[7]=1} |
||
266 | \condition{\all[8] \clean[8]}{\check[8]=1} |
||
267 | \condition{\all[9] \clean[9]}{\check[9]=1} |
||
268 | \condition{\all[10] \clean[10]}{\check[10]=1} |
||
269 | \condition{\all[11] \clean[11]}{\check[11]=1} |
||
270 | \condition{\all[12] \clean[12]}{\check[12]=1} |
||
271 | \condition{\all[13] \clean[13]}{\check[13]=1} |
||
272 | \condition{\all[14] \clean[14]}{\check[14]=1} |
||
273 | \condition{\all[15] \clean[15]}{\check[15]=1} |
||
274 | \condition{\all[16] \clean[16]}{\check[16]=1} |
||
275 | \condition{\all[17] \clean[17]}{\check[17]=1} |
||
276 | \condition{\all[18] \clean[18]}{\check[18]=1} |
||
277 | \condition{\all[19] \clean[19]}{\check[19]=1} |
||
278 | \condition{\all[20] \clean[20]}{\check[20]=1} |