Rev 15703 | Rev 18061 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
type=game
textarea="data instruction"
iEdit="instruction"
:Joc del penjat
Es tracta d'endevinar una paraula proposant lletres d'acord amb el principi del joc de l'home penjat.
<p class="wims_credits">
Autor del model: <a href="mailto:bernadette.m.riou@orange.fr">Bernadette Perrin-Riou</a>
</p>
:%%%%%%%%%%%%%%%%% ATTENTION %%%%%%%%%%%%%%%%%%%%
Enlevez l'en-tête ci-dessus si vous détruisez les balises pour le modèle !
(Ce sont les lignes qui commencent par un ':'.)
Sinon l'exercice risque de ne pas pouvoir repasser sous Createxo.
:%%%%%%%% Paramètres d'exemples à redéfinir %%%%%%%%%%%%%%%%%
:\title{Joc del penjat}
:\author{Bernadette Perrin-Riou}
:\email{bpr@math.u-psud.fr}
:\credits{}
:Enunciat
Enunciat de l'exercici
\text{instruction=Trobar la paraula oferint lletres una per una.}
:Feedback general
Text que es mostra al final de l'exercici, independentment del resultat.
\text{feedback=Heu trobat la paraula}
:Feedback de fracàs
Text que es mostra al final de l'exercici, quan no s'ha trobat la paraula.
\text{echec=Has perdut!}
:Missatge sobre el nombre d'intents restants
\text{message0=Teniu dret a XXXX errors}
:Tipus de disseny
Elecció del disseny: "Penjat", "Targes vermelles" o "Cranis"
\text{type=item(2,3 (Cranis),
2 (Tarja_vermella, Tarja_verda),
1 (Penjat))}
:Options
Les options peuvent être: <span class="tt">noaccent</span> (ne tient pas compte des accents), <span class="tt">hint</span> (les première et dernière lettres sont affichées).
\text{option=}
:Dades principals.
Introduïu a la primera columna les paraules en minúscules i en la segona una possible indicació.
En el cas dels grups de paraules, reemplaça el blanc amb un <span class="tt">_</span>.
\text{data=éléphant,un animal
chandelier, la première lettre est c
mouette_rieuse, sur la plage
vague, sur la plage
}
:%%%%%%%%%%%%%% Rien à modifier avant l'énoncé %%%%%%%%%%%%%%%%
\text{Indication=Indicació}
\text{motatrouver=Paraula a trobar}
\text{proposer=Proposa una lletra en minúscula}
\text{typename=wims(declosing wims(word 2 to -1 of \type))}
\text{type=wims(word 1 of \type)}
\text{typename=wims(words2items wims(nospace \typename))}
\text{typename=slib(oef/blank _,,\typename)}
\text{mot=randrow(\data)}
\text{indication=\mot[2..-1]}
\text{mot=\mot[1]}
\text{jok=—}
\css{<style>
.centrer{text-align:center;}
.seen {opacity:.5;font-weight: bold;}
.lettres{display: flex;
flex-wrap: wrap;
justify-content: center;}
.lettres span{background-color:orange;font-size:20px;font-family:monospace;padding:0 .5em;}
.w {padding : 0 2px;}
.word {background-color:orange;font-size:20px;white-space: nowrap;}
.forget {background-color:red;color:white;font-size:20px;}
.good {color:green;}
.bad {color:red;}
.indication {font-size:16px;font-weight:bold;}
.pendu {background-color:#CCC;width:80%;margin:auto;min-height:54px;padding:3px;}
.reponse, .lettres, .question {margin:1em;}
.dessin{border-right:1px dashed gray;}
.small_col{width:25%;}
.large_col{max-width:75%;}
.floating{float:left;}
.type2 span {background-color:green;color:green; display: inline-block; min-height: 40px;width: 40px;padding:0 .5em;margin:2px;}
.type2 span.red {background-color:red;color:red;}
.type1 {min-width:210px;}
.type2,.type3 {min-width:80px;}
</style>
}
\if{\type=1}{
\text{dessin=xrange 0,10
yrange 0,10
lines black, 0,1,2,1
lines black,1,1,1,8,5,8,5,6.5
linewidth 3}
\matrix{pendu=ellipse 5,6,1.5,1.5,red
lines red, 5,5.4,5,3
lines red,4,4,5,5
lines red,6,4,5,5
lines red,6,2,5,3
lines red,4,2,5,3}
\text{Dessin=<img src="draw(200,200
\dessin)" alt="\typename[1]">}
}
\text{contenu= }
\if{\type=2}{
\text{contenu=\typename[2]}
}
\if{\type>1}{
\text{order=shuffle(6)}
\text{dessin=
<div class="pendu">
<span id="essai_4">\contenu</span>
<span id="essai_5">\contenu</span>
<span id="essai_6">\contenu</span>
<span id="essai_1">\contenu</span>
<span id="essai_2">\contenu</span>
<span id="essai_3">\contenu</span>
</div>
}
\text{Dessin=\dessin}
}
\text{nb=wims(charcnt \mot)}
\text{mot1=wims(words2items wims(singlespace \mot))}
\text{mot=wims(replace internal , by _ in \mot1)}
\text{mot=wims(text expand \mot using 10)}
\text{mot=wims(words2items \mot)}
\text{blanc=position(_,\mot)}
\text{MOT=wims(makelist \jok for x=1 to \nb)}
\for{a in \blanc}{
\text{MOT=wims(replace item number \a by _ in \MOT)}
}
option première et dernière lettre
\if{hint isin \option}{
\text{MOT=wims(replace item number 1 by \mot[1] in \MOT)}
\text{MOT=wims(replace item number -1 by \mot[-1] in \MOT)}
}
\text{MOT1=wims(makelist <span class="w">x</span> for x in \MOT) }
\text{MOT2=wims(items2words \MOT1)}
\text{MOT2=wims(replace internal _ by in \MOT2)}
\text{nstep=r1}
\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}
\text{accents=à,ä,â,é,è,ê,ë,î,ï,ô,ö,û,ù,ç}
\text{ponctu=?,!,-}
\text{lettre1=\lettre1,\accents,\ponctu}
\text{accents=wims(replace internal , by in \accents)}
\text{ponctu=wims(replace internal , by in \ponctu)}
\text{lettre=wims(makelist <span class="notseen">x</span> for x in \lettre1)}
\text{lettre2=wims(replace internal , by in \lettre)}
\nextstep{\nstep}
\text{cnt=0}
\integer{reste=6 - \cnt}
\text{message=wims(replace internal XXXX by <strong>\reste</strong> in \message0)}
\if{noaccent isin \option}{
\text{motnoaccent=wims(deaccent \mot)}
}{\text{motnoaccent=\mot}}
\statement{
<div class="instruction">\instruction</div>
\if{\indication!=\empty}{
<p><em>\Indication : <span class="indication">\indication</span></em></p>
}
<div class="floating small_col centrer type\type">
<div class="dessin">
<p>\message</p>
\Dessin
</div>
</div>
<div class="floating large_col centrer">
<div class="question">\motatrouver :<span class="word">\MOT2</span></div>
<div class="reponse">
<label for="reply\step">\proposer :</label>
\embed{r\step,1
default
maxlength="1" pattern="[a-z\accents\ponctu]" style="text-align:center;"}
</div>
<div class="lettres">\lettre2</div>
</div>
}
\answer{}{\rep1}{type=case}{option=noanalyzeprint}
\answer{}{\rep2}{type=case}{option=noanalyzeprint}
\answer{}{\rep3}{type=case}{option=noanalyzeprint}
\answer{}{\rep4}{type=case}{option=noanalyzeprint}
\answer{}{\rep5}{type=case}{option=noanalyzeprint}
\answer{}{\rep6}{type=case}{option=noanalyzeprint}
\answer{}{\rep7}{type=case}{option=noanalyzeprint}
\answer{}{\rep8}{type=case}{option=noanalyzeprint}
\answer{}{\rep9}{type=case}{option=noanalyzeprint}
\answer{}{\rep10}{type=case}{option=noanalyzeprint}
\answer{}{\rep11}{type=case}{option=noanalyzeprint}
\answer{}{\rep12}{type=case}{option=noanalyzeprint}
\answer{}{\rep13}{type=case}{option=noanalyzeprint}
\answer{}{\rep14}{type=case}{option=noanalyzeprint}
\answer{}{\rep15}{type=case}{option=noanalyzeprint}
\answer{}{\rep16}{type=case}{option=noanalyzeprint}
\answer{}{\rep17}{type=case}{option=noanalyzeprint}
\answer{}{\rep18}{type=case}{option=noanalyzeprint}
\answer{}{\rep19}{type=case}{option=noanalyzeprint}
\answer{}{\rep20}{type=case}{option=noanalyzeprint}
\answer{}{\rep21}{type=case}{option=noanalyzeprint}
\answer{}{\rep22}{type=case}{option=noanalyzeprint}
\answer{}{\rep23}{type=case}{option=noanalyzeprint}
\answer{}{\rep24}{type=case}{option=noanalyzeprint}
\answer{}{\rep25}{type=case}{option=noanalyzeprint}
\answer{}{\rep26}{type=case}{option=noanalyzeprint}
\answer{}{\rep27}{type=case}{option=noanalyzeprint}
\answer{}{\rep28}{type=case}{option=noanalyzeprint}
\answer{}{\rep29}{type=case}{option=noanalyzeprint}
\answer{}{\rep30}{type=case}{option=noanalyzeprint}
\text{rep=\rep1,\rep2,\rep3,\rep4,\rep5,\rep6,\rep7,\rep8,\rep9,\rep10,\rep11,\rep12,\rep13,\rep14,
\rep15,\rep16,\rep17,\rep18,\rep19,\rep20,\rep21,\rep22,\rep23,\rep24,
\rep25,\rep26,\rep27,\rep28,\rep29,\rep30}
\text{w_class=good}
\if{\rep[\step-1] notitemof \mot }{
\integer{cnt=\cnt+1}
\integer{reste=6 - \cnt}
\text{w_class=bad}
\if {\reste > 0}{
\text{message=wims(replace internal XXXX by <strong>\reste</strong> in \message0)}
}
\if {\reste <= 0} {
\text{message=<strong class="oef_condbad">\echec</strong>}
}
\if{\type = 1}{
\text{dessin=\dessin
\pendu[\cnt;]}
\text{Dessin=<img src="draw(200,200
\dessin)" alt="Vous avez fait \cnt erreur(s). Vous avancez vers la pendaison...">}
}
\if{\type>1}{
\integer{h=\order[\cnt]}
\text{jj=<span id="essai_\h">\contenu</span>}
\if{\type=2}{
\text{dessin=wims(replace internal \jj by <span class="red">\typename[1]</span> in \dessin)}
}
\if{\type=3}{
\text{dessin=wims(replace internal \jj by <img src="gifs/images/skull_and_crossbones50.png" alt="\typename[1]"> in \dessin)}
}
\text{Dessin=\dessin}
}
}
%% On affiche differement les lettres deja tapées
\text{z=position(\rep[\step-1],\lettre1)}
\text{lettre=wims(replace internal item number \z by <span class="seen \w_class">\rep[\step-1]</span> in \lettre)}
\text{lettre2=wims(items2words \lettre)}
\text{z=position(\rep[\step-1],\mot)}
\for{k in \z}{
\text{MOT=wims(replace internal item number \k by \rep[\step-1] in \MOT)}
}
\if{noaccent isin \option}{
\text{z=position(\rep[\step-1],\motnoaccent)}
\for{k in \z}{
\text{MOT=wims(replace internal item number \k by \mot[\k] in \MOT)}
}
}
\text{MOT1=wims(makelist <span class="w">x</span> for x in \MOT)}
\text{MOT2=wims(items2words \MOT1)}
\text{MOT2=wims(replace internal _ by in \MOT2)}
\text{nstep=}
\text{nstep=\jok isitemof \MOT and \step<30 and \cnt<6 ? r \step}
\if{\step>30 or \cnt>=6}{
\text{w=position(\jok,\MOT)}
\for{a in \w}{
\text{MOT1=wims(replace internal item number \a by <span class="w forget">\mot[\a]</span> in \MOT1)}
}
\text{MOT2=wims(items2words \MOT1)}
\text{MOT2=wims(replace internal _ by in \MOT2)}
}
\condition{Avez-vous trouvé le mot ?}{\jok notitemof \MOT}
\condition{}{\cnt<=3}{option=hide}
\condition{}{\cnt<=4}{option=hide}