summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex')
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex104
1 files changed, 104 insertions, 0 deletions
diff --git a/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex
new file mode 100644
index 0000000000..f9530be658
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex
@@ -0,0 +1,104 @@
+\setKVdefault[JeuRgt]{Creation=false,Deno=12,Graines=false,Largeur=15pt,Hauteur=20pt,Negatif=false,Decimaux=false,Solution=false}
+\defKV[JeuRgt]{Graine=\setKV[JeuRgt]{Graines}}%
+
+\newlength{\PfCJeuRgtH}
+
+\NewDocumentCommand\DefiRangement{omm}{%
+ \useKVdefault[JeuRgt]%
+ \setKV[JeuRgt]{#1}%
+ \setlength{\PfCJeuRgtH}{\useKV[JeuRgt]{Hauteur}+\tabcolsep}%
+ \ifboolKV[JeuRgt]{Graines}{\PfCGraineAlea{\useKV[JeuRgt]{Graine}}}{}%
+ % On décompose la phrase
+ \xdef\PfCFooDepart{}%
+ \StrLen{#2}[\LongueurMot]%
+ \xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{%
+ \StrChar{#2}{##1}[\LettreMot]%
+ \xdef\PfCFooDepart{\PfCFooDepart\LettreMot/}%
+ }%
+ \setsepchar[*]{/}\reademptyitems%
+ \readlist*\ListeDesLettres{\PfCFooDepart}%
+% La liste des Lettres est \showitems\ListeDesLettres[]%
+ % Liste des nombres
+ \ifboolKV[JeuRgt]{Creation}{%
+ \xdef\ListeDesChoix{}%
+ \ifboolKV[JeuRgt]{Negatif}{%
+ \xdef\ListeDesChoix{-1}%
+ \xintFor* ##1 in{\xintSeq{2}{50}}\do{%
+ \xdef\ListeDesChoix{\ListeDesChoix,-##1}%
+ }%
+ \xintFor* ##1 in{\xintSeq{2}{50}}\do{%
+ \xdef\ListeDesChoix{\ListeDesChoix,##1}%
+ }%
+ }{%
+ \xintFor* ##1 in{\xintSeq{2}{100}}\do{%
+ \xdef\ListeDesChoix{\ListeDesChoix,##1}%
+ }%
+ }%
+ \MelangeListe{\ListeDesChoix}{\LongueurMot}%
+ % Liste des nombres \faa et maintenant rangée
+ \Rangement[Seul]{\faa}% \PfCListeRgtRecup
+ \setsepchar{,}%
+ % Liste des nombres
+ \readlist*\ListeDesNombres{\PfCListeRgtRecup}
+ }{%
+ \setsepchar{,}%
+ % Liste des nombres
+ \readlist*\ListeDesNombres{#3}
+ }%
+ % \\La liste des nombres est \showitems\ListeDesNombres[]
+ % On crée la liste des compteurs mélangés
+ \xdef\PfCFooListe{}%
+ \xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{%
+ \xdef\PfCFooListe{\PfCFooListe ##1,}
+ }%
+ % On mélange la liste des compteurs
+ \MelangeListe{\PfCFooListe}{\LongueurMot}
+ % On obtient la liste demandée
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListeCompteursMelanges{\faa}
+ \reademptyitems
+ % \\La liste des compteurs mélangés est \showitems\ListeCompteursMelanges[]
+ % Les associations
+ % \foreachitem\Lettre\in\ListeCompteursMelanges{%
+ % \xdef\Compteur{\ListeCompteursMelanges[\Lettrecnt]}
+ % \ListeDesLettres[\Compteur] -- \ListeDesNombres[\Compteur]\\
+ % }%
+ % \begin{center}
+ \begin{NiceTabular}{*{\LongueurMot}{m{\useKV[JeuRgt]{Largeur}}}}[vlines]%
+ \hline
+ \rule{0pt}{\PfCJeuRgtH}\xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{%
+ \xintifForFirst{}{&}\Block{}{\xdef\Compteur{\ListeCompteursMelanges[##1]}\ListeDesLettres[\Compteur]}%
+ }%
+ \\
+ \hline
+ \rule{0pt}{\PfCJeuRgtH}\xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{%
+ \xintifForFirst{}{&}\Block{}{%
+ \xdef\Compteur{\ListeCompteursMelanges[##1]}%
+ \ifboolKV[JeuRgt]{Creation}{%
+ \ifboolKV[JeuRgt]{Decimaux}{\num{\fpeval{\ListeDesNombres[\Compteur]/\useKV[JeuRgt]{Deno}}}}{\Simplification{\ListeDesNombres[\Compteur]}{\useKV[JeuRgt]{Deno}}}}{%
+ \ListeDesNombres[\Compteur]%
+ }%
+ }
+ }%
+ \\
+ \ifboolKV[JeuRgt]{Solution}{%
+ \hline
+ \rule{0pt}{\PfCJeuRgtH}\xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{%
+ \xintifForFirst{}{&}\Block{}{\ListeDesLettres[##1]}%
+ }%
+ \\
+ \hline
+ \rule{0pt}{\PfCJeuRgtH}\xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{%
+ \xintifForFirst{}{&}\Block{}{%
+ \ifboolKV[JeuRgt]{Creation}{%
+ \ifboolKV[JeuRgt]{Decimaux}{\num{\fpeval{\ListeDesNombres[##1]/\useKV[JeuRgt]{Deno}}}}{\Simplification{\ListeDesNombres[##1]}{\useKV[JeuRgt]{Deno}}}}{%
+ \ListeDesNombres[##1]%
+ }%
+ }%
+ }%
+ \\
+ }{}%
+ \hline
+ \end{NiceTabular}
+ % \end{center}
+} \ No newline at end of file