Subversion Repositories wimsdev

Rev

Rev 13715 | Rev 15691 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4137 bpr 1
type=game
13715 obado 2
textarea="data instruction"
3
iEdit="instruction"
4137 bpr 4
 
5
:Hangman
6
Find the words by selecting letters from the list provided. To win, the word must be found
7
before the man is hanged.
13477 obado 8
<p class="wims_credits">
15179 lemaire 9
Author of the model : <a href="mailto:bernadette.m.riou@orange.fr">Bernadette Perrin-Riou</a>
4137 bpr 10
</p>
11
:%%%%%%%%%%%%%%%%%      ATTENTION      %%%%%%%%%%%%%%%%%%%%
12
 
13
Remove the above header if you destroy the model tags i.e. the lines starting
14
with a ':'. Otherwise the exercise might not be recognised by Createxo.
15
 
5722 bpr 16
:%%%%%%%% Example parameters to be redefined %%%%%%%%%%%%%%%%%
4137 bpr 17
:\title{Hangman}
5147 bpr 18
:\author{Csilla, Ducrocq}
5724 bpr 19
:\email{}
20
:\credits{}
13477 obado 21
 
4137 bpr 22
:Instruction
23
Instruction
24
\text{instruction=Select the letters one by one and write the missing word.}
25
 
26
:Text of the feedback. This can be changed as you wish.
27
 
28
\text{feedback=That's right!}
5722 bpr 29
 
30
:Feedback d'echec
31
Texte affiché à la fin de l'exercice, quand le mot n'a pas été trouvé.
32
\text{echec=Perdu !}
33
 
34
:Message sur le nombre d'essais restant
35
 
36
\text{message=Vous avez droit à XXXX erreurs}
37
 
8512 bpr 38
:Type of drawing
4137 bpr 39
Choix du dessin.  1: hangman, 2: rectangles with changing colours, 3: skull and crossbones
5722 bpr 40
\text{type=item(2,3 (skull and crossbones),
41
	2 (rectangles with changing colours),
42
	1 (hangman))}
43
 
4137 bpr 44
:Main data.
45
Write the missing words in the first column in lower case, write helps in the second column.
46
The words and the helps are separated by a comma.
47
 
48
\text{data=whale,the biggest mammal on Earth
49
rabbit,an animal with long ears
50
mouse,can refer to an animal or a computer device
51
hedgehog,an animal with prickles
52
giraffe, an animal with a very long neck
53
lion, is also called the king of the animals}
54
 
55
:%%%%%%%%%%%%%% Nothing to modify before the statement  %%%%%%%%%%%%%%%%
5722 bpr 56
\text{Indication=Hint}
57
\text{motatrouver=Word to find}
58
\text{proposer=Select a letter (small)}
59
\text{typename=wims(declosing wims(word 2 to -1 of \type))}
60
\text{type=wims(word 1 of \type)}
61
\text{typename=wims(words2items wims(nospace \typename))}
8512 bpr 62
\text{typename=slib(oef/blank _,,\typename)}
4137 bpr 63
\text{mot=randrow(\data)}
64
\text{indication=\mot[2..-1]}
65
\text{mot=\mot[1]}
5722 bpr 66
\text{jok=&mdash;}
13715 obado 67
\css{<style>
5722 bpr 68
.centrer{text-align:center;}
69
.seen {opacity:0.5;font-weight: bold;}
70
.lettres span{background-color:orange;font-size:20px;font-family:monospace;padding:0 0.5em;}
71
.w {padding : 0 2px;}
72
.word {background-color:orange;font-size:20px;white-space: nowrap;}
73
.forget {background-color:red;color:white;font-size:20px;}
74
.good {color:green;}
75
.bad  {color:red;}
76
.indication {font-size:16px;font-weight:bold;}
77
.pendu {background-color:#CCC;width:80%;margin:auto;min-height:54px;padding:3px;}
78
.reponse, .lettres, .question {margin:1em;}
79
 
80
.dessin{border-right:1px dashed gray;}
81
.small_col{width:25%;}
82
.large_col{max-width:75%;}
83
.floating{float:left;}
84
 
85
.type2 span {background-color:green;color:green; display: inline-block; min-height: 40px;width: 40px;padding:0 0.5em;margin:2px;}
86
.type2 span.red {background-color:red;color:red;}
87
.type1 {min-width:210px;}
88
.type2,.type3  {min-width:80px;}
4137 bpr 89
</style>
90
}
91
\if{\type=1}{
5722 bpr 92
 \text{dessin=xrange 0,10
4137 bpr 93
yrange 0,10
94
lines black, 0,1,2,1
95
lines black,1,1,1,8,5,8,5,6.5
96
linewidth 3}
5722 bpr 97
 
4137 bpr 98
\matrix{pendu=ellipse 5,6,1.5,1.5,red
99
lines red, 5,5.4,5,3
100
lines red,4,4,5,5
101
lines red,6,4,5,5
102
lines red,6,2,5,3
103
lines red,4,2,5,3}
5722 bpr 104
 
105
\text{Dessin=<img src="draw(200,200
106
\dessin)" alt="\typename[1]"/>}
107
 
4137 bpr 108
}
5722 bpr 109
 
110
\text{contenu=&nbsp;}
4137 bpr 111
\if{\type=2}{
5722 bpr 112
  \text{contenu=\typename[2]}
4137 bpr 113
}
5722 bpr 114
 
115
\if{\type>1}{
116
 \text{order=shuffle(6)}
117
 \text{dessin=
118
 <div class="pendu">
119
  <span id="essai_4">\contenu</span><span id="essai_5">\contenu</span>
120
  <span id="essai_6">\contenu</span><span id="essai_1">\contenu</span>
121
  <span id="essai_2">\contenu</span><span id="essai_3">\contenu</span>
122
  </div>
123
 }
124
 \text{Dessin=\dessin}
4137 bpr 125
}
126
 
127
\text{nb=wims(charcnt \mot)}
128
\text{mot1=wims(words2items wims(singlespace \mot))}
129
\text{mot=wims(replace internal , by _ in \mot1)}
130
\text{mot=wims(text expand \mot using 10)}
131
\text{mot=wims(words2items \mot)}
4755 bpr 132
\text{blanc=position(_,\mot)}
4137 bpr 133
\text{MOT=wims(makelist \jok for x=1 to \nb)}
4755 bpr 134
\for{a in \blanc}{
135
  \text{MOT=wims(replace item number \a by _ in \MOT)}
136
}
5722 bpr 137
\text{MOT1=wims(makelist <span class="w">x</span> for x in \MOT) }
4137 bpr 138
\text{MOT2=wims(items2words \MOT1)}
4755 bpr 139
\text{MOT2=wims(replace internal _ by &nbsp; in \MOT2)}
4137 bpr 140
 
141
\text{nstep=r1}
142
 
5722 bpr 143
\text{lettre1=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}
144
\text{accents=à,ä,â,é,è,ê,ë,î,ï,ô,ö,û,ù,-,!,?}
145
   \text{lettre1=\lettre1,\accents}
146
\text{lettre=wims(makelist <span class="notseen">x</span> for x in \lettre1)}
4137 bpr 147
\text{lettre2=\lettre}
148
\text{lettre2=\lettre2[1..10]
5722 bpr 149
<br/>\lettre2[11..20]
150
<br/>\lettre2[21..30]
151
<br/>\lettre2[31..-1]}
4137 bpr 152
\text{lettre2=wims(replace internal ,  by in \lettre2)}
153
\nextstep{\nstep}
154
\text{cnt=0}
155
 
5722 bpr 156
\integer{reste=6 - \cnt}
157
\text{message=wims(replace internal XXXX by <strong>\reste</strong> in \message0)}
158
\statement{
8512 bpr 159
	<p class="instruction">\instruction</p>
5722 bpr 160
	<p ><em>\Indication&nbsp;: <span class="indication">\indication</span></em></p>
161
<div class="floating small_col centrer type\type">
162
 <div class="dessin"><p>\message</p>
163
\Dessin</div>
164
</div>
165
 <div class="floating large_col centrer">
166
  <div class="question">\motatrouver&nbsp;:<span class="word"> \MOT2</span></div>
167
  <div class="reponse">
168
   <label for="reply\step">\proposer&nbsp;: </label>
169
   \embed{r\step,1
170
   default
11557 bpr 171
   autocomplete="off" maxlength="1" style="text-align:center;"}
5722 bpr 172
  </div>
173
  <div class="lettres">\lettre2</div>
174
 </div>
4137 bpr 175
 
5722 bpr 176
<br style="clear:both;"/>
4137 bpr 177
}
178
 
179
\answer{}{\rep1}{type=case}{option=noanalyzeprint}
180
\answer{}{\rep2}{type=case}{option=noanalyzeprint}
181
\answer{}{\rep3}{type=case}{option=noanalyzeprint}
182
\answer{}{\rep4}{type=case}{option=noanalyzeprint}
183
\answer{}{\rep5}{type=case}{option=noanalyzeprint}
184
\answer{}{\rep6}{type=case}{option=noanalyzeprint}
185
\answer{}{\rep7}{type=case}{option=noanalyzeprint}
186
\answer{}{\rep8}{type=case}{option=noanalyzeprint}
187
\answer{}{\rep9}{type=case}{option=noanalyzeprint}
188
\answer{}{\rep10}{type=case}{option=noanalyzeprint}
189
\answer{}{\rep11}{type=case}{option=noanalyzeprint}
190
\answer{}{\rep12}{type=case}{option=noanalyzeprint}
191
\answer{}{\rep13}{type=case}{option=noanalyzeprint}
192
\answer{}{\rep14}{type=case}{option=noanalyzeprint}
193
\answer{}{\rep15}{type=case}{option=noanalyzeprint}
194
\answer{}{\rep16}{type=case}{option=noanalyzeprint}
195
\answer{}{\rep17}{type=case}{option=noanalyzeprint}
196
\answer{}{\rep18}{type=case}{option=noanalyzeprint}
197
\answer{}{\rep19}{type=case}{option=noanalyzeprint}
198
\answer{}{\rep20}{type=case}{option=noanalyzeprint}
199
\answer{}{\rep21}{type=case}{option=noanalyzeprint}
200
\answer{}{\rep22}{type=case}{option=noanalyzeprint}
201
\answer{}{\rep23}{type=case}{option=noanalyzeprint}
202
\answer{}{\rep24}{type=case}{option=noanalyzeprint}
203
\answer{}{\rep25}{type=case}{option=noanalyzeprint}
204
\answer{}{\rep26}{type=case}{option=noanalyzeprint}
205
\answer{}{\rep27}{type=case}{option=noanalyzeprint}
206
\answer{}{\rep28}{type=case}{option=noanalyzeprint}
207
\answer{}{\rep29}{type=case}{option=noanalyzeprint}
208
\answer{}{\rep30}{type=case}{option=noanalyzeprint}
209
 
210
\text{rep=\rep1,\rep2,\rep3,\rep4,\rep5,\rep6,\rep7,\rep8,\rep9,\rep10,\rep11,\rep12,\rep13,\rep14,
4754 bpr 211
 \rep15,\rep16,\rep17,\rep18,\rep19,\rep20,\rep21,\rep22,\rep23,\rep24,
212
 \rep25,\rep26,\rep27,\rep28,\rep29,\rep30}
4137 bpr 213
 
5722 bpr 214
 
215
\text{w_class=good}
216
 
217
\if{\rep[\step-1] notitemof \mot }{
218
 \integer{cnt=\cnt+1}
219
 \integer{reste=6 - \cnt}
220
 \text{w_class=bad}
221
 
222
 \if {\reste > 0}{
223
  \text{message=wims(replace internal XXXX by <strong>\reste</strong> in \message0)}
224
 }
225
 \if {\reste <= 0} {
226
  \text{message=<strong class="oef_condbad">\echec</strong>}
227
 }
228
 
229
 \if{\type = 1}{
230
 \text{dessin=\dessin
231
  \pendu[\cnt;]}
232
 \text{Dessin=<img src="draw(200,200
233
 \dessin)" alt="Vous avez fait \cnt erreur(s). Vous avancez vers la pendaison..."/>}
234
 }
235
 
236
 \if{\type>1}{
237
  \integer{h=\order[\cnt]}
238
  \text{jj=<span id="essai_\h">\contenu</span>}
239
  \if{\type=2}{
240
   \text{dessin=wims(replace internal \jj by <span class="red">\typename[1]</span> in \dessin)}
241
  }
242
  \if{\type=3}{
243
   \text{dessin=wims(replace internal \jj by <img src="gifs/images/skull_and_crossbones50.png" alt="\typename[1]"/> in \dessin)}
244
  }
8512 bpr 245
  \text{Dessin=\dessin}
5722 bpr 246
 }
247
}
248
 
249
# On affiche differement les lettres deja tapées
4137 bpr 250
\text{z=position(\rep[\step-1],\lettre1)}
5722 bpr 251
\text{lettre=wims(replace internal item number \z by <span class="seen \w_class">\rep[\step-1]</span> in \lettre)}
252
 
253
# On repartit les lettres par groupes de 10 maxi par ligne
4137 bpr 254
\text{lettre2=\lettre[1..10]
5722 bpr 255
<br/>\lettre[11..20]
256
<br/>\lettre[21..30]
257
<br/>\lettre[31..-1]}
4137 bpr 258
\text{lettre2=wims(replace internal , by in \lettre2)}
5722 bpr 259
 
260
 
4137 bpr 261
\text{z=position(\rep[\step-1],\mot)}
262
\for{k in \z}{
263
  \text{MOT=wims(replace internal item number \k by \rep[\step-1] in \MOT)}
264
}
5722 bpr 265
 
266
\text{MOT1=wims(makelist <span class="w">x</span> for x in \MOT)}
4137 bpr 267
\text{MOT2=wims(items2words \MOT1)}
4755 bpr 268
\text{MOT2=wims(replace internal _ by &nbsp; in \MOT2)}
4137 bpr 269
\text{nstep=}
270
\text{nstep=\jok isitemof \MOT and \step<30 and \cnt<6 ? r \step}
271
\if{\step>30 or \cnt>=6}{
272
  \text{w=position(\jok,\MOT)}
273
  \for{a in \w}{
5722 bpr 274
    \text{MOT1=wims(replace internal item number \a by <span class="w forget">\mot[\a]</span> in \MOT1)}
4137 bpr 275
  }
276
  \text{MOT2=wims(items2words \MOT1)}
4755 bpr 277
  \text{MOT2=wims(replace internal _ by &nbsp; in \MOT2)}
4137 bpr 278
}
279
 
280
\condition{Vous avez trouvé le mot ?}{\jok notitemof \MOT}
281
\condition{}{\cnt<=3}{option=hide}
282
\condition{}{\cnt<=4}{option=hide}