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