%%Le source de cet exercice a été créé à l'aide de Quicktool
%%Le type de l'exercice est TONIC.
%% Vous pouvez le modifier si vous désirez l'adapter.
%% Sun Aug 24 20:20:07 2008

###################
\title{Word stress patterns Tonic}
\author{Csilla Ducrocq}
\email{csilla.ducrocq@u-psud.fr}
\language{fr}
\computeanswer{no}
\format{html}
\text{file=word_stress_patterns_tonic}
\text{notepad=slib(utilities/notepad Notepad,small)}
\text{instruction=asis(Listen to the word and click on the stressed syllable.)}
\text{instruction2=asis()}
\text{choice=}
\text{common=}
\text{audio_file=no}
\text{reading_file=no}
\text{image_file=no}
\text{video_file=no}
\text{alea=yes}
\text{size=}
\text{partialscore=split}
\text{percent=1}
\text{aucune=aucune de ces possibilités}
\text{format=clickfill}
\text{specialhelp1=}
\text{specialhelp2=}
\text{specialhelp3=}
\text{helpprompt=}
\text{reaccent=}
\text{style_question=background-color: #99CCFF;	margin: 2% 5%;	padding: 2%;}
\text{style_reponse=background-color: #FFCC99;	color: black;	margin: 2% 5%;	padding: 2%;}
\text{style_oef=}
\text{style_css=ol li {list-style: upper-alpha; }}
\text{paste=yes}
\text{pos_rep=inside}
\text{second_step=yes}
\text{first_step=1}
\text{answer_given=}
\text{try=}
\text{packs=}
\text{player=---}
#####################

\text{file0=randitem(\file)}
\integer{cnt_question= wims(recordcnt \file0)}

################
\text{MAX=3}
\text{N=1}
\text{M=3}
################
\text{autocompletion=\format iswordof case ? autocomplete=off}
\text{player=wims(replace internal - by in \player)}
\text{specialhelp=\specialhelp1,\specialhelp2,\specialhelp3}
\text{helpprompt=\helpprompt = ?++>}
\integer{first_step=\first_step notwordof 0 ? 1}
\text{option_reaccent=\reaccent!=yes ? noreaccent:}
\text{nopaste=\paste issametext no ? slib(utilities/nopaste )}

\text{instruction=\instruction issametext ? wims(getdef instruction in \file0)}
\text{instruction2=\instruction2 issametext ? wims(getdef instruction2 in \file0)}
\text{size=\size issametext ? wims(getdef size in \file0)}
\text{reading_file=\reading_file issametext ? wims(getdef reading_file in \file0)}
\text{reading = wims(record 0 of \reading_file)}

\text{audio_file = \audio_file issametext ? wims(getdef audio_file in \file0)}
\text{audio=\audio_file notsametext  and  \audio_file notsametext no? 
<p align="center">slib(media/audio \imagedir/\audio_file,player=\player)</p>}

\text{image_file=\image_file issametext ? wims(getdef image_file in \file0)}
\text{image=\image_file notsametext  and  \image_file notsametext no? 
wims(makelist <img src=\imagedir/x> for x in \image_file)}

\text{video_file=\video_file issametext ? wims(getdef video_file in \file0)}
\if{\video_file notsametext  and  \video_file notsametext no}{ 
  \text{video_file=http notin \video_file ? \imagedir/\video_file}
\text{video=\video_file notsametext ? <a wims_target=external href="\video_file">[video] </a></p>}
}
\text{choix=\choice issametext ? wims(getdef choice in \file0):\choice}

\text{style = <style type="text/css">
 .question {\style_question}
 .reponse {\style_reponse}
 .oefstatement{\style_oef}
 \style_css
 </style>
 }

\text{try =\try notwordof 1 2 3 4 5 6 7 8 9 10 ? 1}
\text{size=\format iswordof dragfill clickfill ? \size x 1}
\integer{N = min(\cnt_question,\N)}
\integer{MAX=min(\N*\MAX,\cnt_question)}
\text{battage=\alea issametext yes ? shuffle(\cnt_question) :
wims(makelist x for x = 1 to \cnt_question)}
     
Si le nom du fichier  n'est pas présent : 
le_mot_deaccentué.mp3
Si il y a un nom de fichier global, alea=no et
fichier audio global. 

On en prend alors un certain nombre mais dans l'ordre (pas tous)

text{battage=\alea issametext no ?wims(sort numeric items \battage)}
\text{Rep=}
\text{Mot2=}
\text{Syllabe=}
\text{Audio=}
\text{cnt_syl=}
\text{etape_step=0}
\text{etape=0}
\for{i= 1 to \MAX}{
  \matrix{data = wims(record \battage[\i] of \file0)}
  \integer{cnt_data=rows(\data)}
  \integer{cnt_data=pari(ceil(\cnt_data/3))}
  \text{ordre=shuffle(\cnt_data)}
  \for{ h = 1 to \cnt_data}{
    \integer{v = -3+3*\ordre[\h]}
    \text{mot=\data[1+\v;]}
    \matrix{Rep=\Rep
      \data[2+\v;]}
    \text{mot2=wims(nospace wims(replace internal / by  in \mot))}
    \matrix{Mot2 = \Mot2
     \mot2}
    \text{syllabe=wims(nonempty items wims(replace internal / by ,  in \mot))}
    \matrix{Syllabe =\Syllabe
      \syllabe}
    \text{cnt_syl=\cnt_syl, items(\syllabe)}
    \if{\audio_file issametext no}{
      \text{audi=\data[3+\v;]}
      \text{audi=\audi issametext ? wims(deaccent \mot2).mp3}
      \text{Audio = \Audio,slib(media/audio \imagedir/\audi)}
    }
  }
  \integer{etape=\etape + \cnt_data}
 \text{etape_step=\etape_step,\etape}
}
Je n'ai pas tenu compte du N 
\integer{cnt_step=items(\etape_step)-1}
\text{cnt_qu=rows(\Rep)}
\text{cnt_syl=wims(nonempty items \cnt_syl)}
\text{Audio=wims(nonempty items \Audio)}
\text{STEP=wims(makelist r x for x=1 to \cnt_qu)}
\matrix{STEPS = }
\matrix{CNT = }
\integer{u=1}
\integer{T = \etape_step[1]}
\while{ \T notsametext }{
   \matrix{STEPS = \STEPS
wims(makelist r x for x = \etape_step[\N*(\u-1)+1]+1  to \etape_step[\N*\u+1])}
   \matrix{CNT =\CNT
wims(makelist x for x = \etape_step[\N*(\u-1)+1]+1  to \etape_step[\N*\u+1])}
   \integer{u = \u + 1}
   \text{T = \etape_step[\N*(\u-1)+1]}
}

matrix{STEPS = \STEPS
   wims(makelist r x  for x = \etape_step[\cnt_step+1] to \MAX)}
matrix{CNT = \CNT
 wims(makelist x  for x = \etape_step[\cnt_step+1] to \MAX)}

\steps{\STEPS}
\statement{\nopaste\style \instruction
  \if{\reading notsametext }{\special{help reading,[à lire]}}
  \if{\image notsametext }{\special{help image,[à regarder]}}
  \audio\video
  \if{\cnt_qu=1}{<center>\Audio[1] 
   \for{ s = 1 to \cnt_syl[1]}{\embed{reply 1,\s}}
   </center>}
   {<ol>
     \for{t in  \CNT[\step;]}{ <li> \Audio[\t] 
        \for{ s = 1 to \cnt_syl[\t]}{\embed{reply \t,\s}} 
        </li>}
     </ol>
   }
}

\answer{}{\Rep[1;];\Syllabe[1;]}{type=mark}
\answer{}{\Rep[2;];\Syllabe[2;]}{type=mark}
\answer{}{\Rep[3;];\Syllabe[3;]}{type=mark}
\answer{}{\Rep[4;];\Syllabe[4;]}{type=mark}
\answer{}{\Rep[5;];\Syllabe[5;]}{type=mark}
\answer{}{\Rep[6;];\Syllabe[6;]}{type=mark}
\answer{}{\Rep[7;];\Syllabe[7;]}{type=mark}
\answer{}{\Rep[8;];\Syllabe[8;]}{type=mark}
\answer{}{\Rep[9;];\Syllabe[9;]}{type=mark}
\answer{}{\Rep[10;];\Syllabe[10;]}{type=mark}
\answer{}{\Rep[11;];\Syllabe[11;]}{type=mark}
\answer{}{\Rep[12;];\Syllabe[12;]}{type=mark}
\answer{}{\Rep[13;];\Syllabe[13;]}{type=mark}
\answer{}{\Rep[14;];\Syllabe[14;]}{type=mark}
\answer{}{\Rep[15;];\Syllabe[15;]}{type=mark}
\answer{}{\Rep[16;];\Syllabe[16;]}{type=mark}
\answer{}{\Rep[17;];\Syllabe[17;]}{type=mark}
\answer{}{\Rep[18;];\Syllabe[18;]}{type=mark}
\answer{}{\Rep[19;];\Syllabe[19;]}{type=mark}
\answer{}{\Rep[20;];\Syllabe[20;]}{type=mark}
\answer{}{\Rep[21;];\Syllabe[21;]}{type=mark}
\answer{}{\Rep[22;];\Syllabe[22;]}{type=mark}
\answer{}{\Rep[23;];\Syllabe[23;]}{type=mark}
\answer{}{\Rep[24;];\Syllabe[24;]}{type=mark}
\answer{}{\Rep[25;];\Syllabe[25;]}{type=mark}
\answer{}{\Rep[26;];\Syllabe[26;]}{type=mark}
\answer{}{\Rep[27;];\Syllabe[27;]}{type=mark}
\answer{}{\Rep[28;];\Syllabe[28;]}{type=mark}
\answer{}{\Rep[29;];\Syllabe[29;]}{type=mark}
\answer{}{\Rep[30;];\Syllabe[30;]}{type=mark}
\answer{}{\Rep[31;];\Syllabe[31;]}{type=mark}
\answer{}{\Rep[32;];\Syllabe[32;]}{type=mark}
\answer{}{\Rep[33;];\Syllabe[33;]}{type=mark}
\answer{}{\Rep[34;];\Syllabe[34;]}{type=mark}
\answer{}{\Rep[35;];\Syllabe[35;]}{type=mark}
\answer{}{\Rep[36;];\Syllabe[36;]}{type=mark}
\answer{}{\Rep[37;];\Syllabe[37;]}{type=mark}
\answer{}{\Rep[38;];\Syllabe[38;]}{type=mark}
\answer{}{\Rep[39;];\Syllabe[39;]}{type=mark}
\answer{}{\Rep[40;];\Syllabe[40;]}{type=mark}     
