% !TEX Fiche « La dame » — source générée par la_dame_generateur.php
% Design « fiches » commun au site (cf. coll/latex_fiche_commun.py).
\documentclass[a4paper,11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel}
\usepackage[a4paper,top=3.2cm,bottom=2cm,left=2cm,right=2cm]{geometry}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{fancyhdr}
\usepackage{qrcode}
\usepackage[table]{xcolor}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}
\AtBeginDocument{%
  \setlist[itemize]{leftmargin=1.8em,itemsep=0.5ex,topsep=0.4ex,parsep=0pt}%
  \setlist[itemize,1]{label=\textcolor{red!75!black}{\small\textbullet}}%
  \setlist[itemize,2]{label=\textcolor{red!75!black}{\scriptsize\textbullet}}%
}
\usepackage{titlesec}
\titlespacing*{\section}{0pt}{1.4ex}{0.6ex}
\titlespacing*{\subsection}{0pt}{1.0ex}{0.3ex}
\usepackage{multicol}
\setlength{\columnsep}{1.5em}
\usepackage{needspace}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\usepackage{tgheros}
\usepackage{xskak,chessboard}
\setchessboard{showmover=false,boardfontsize=12pt}
\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{75pt}
\setlength{\headsep}{10pt}

\newcommand{\logowouf}{%
\begin{tikzpicture}[baseline={(current bounding box.center)},scale=0.55,
                    line cap=round,line join=round]
    \path[use as bounding box] (-2.20,-1.45) rectangle (2.20,2.20);
    \path[
        postaction={decorate},
        decoration={
            text along path,
            text={|\fontfamily{qhv}\bfseries\fontsize{9}{9}\selectfont|site2wouf.fr},
            text align={center},
            raise=0.03ex
        }
    ] (-1.29,0.48) arc[start angle=160,end angle=20,radius=1.29];
    \begin{scope}[xshift=-0.06cm]
        \fill[black] (-0.66,0.14) ellipse (0.21 and 0.31);
        \fill[black] ( 0.66,0.14) ellipse (0.21 and 0.31);
        \fill[black] (-0.23,0.49) ellipse (0.22 and 0.35);
        \fill[black] ( 0.23,0.49) ellipse (0.22 and 0.35);
        \fill[black]
            (0,-0.10)
            .. controls (-0.36,-0.02) and (-0.63,-0.24) .. (-0.58,-0.58)
            .. controls (-0.52,-0.93) and (-0.16,-1.12) .. (0,-0.90)
            .. controls (0.16,-1.12) and (0.52,-0.93) .. (0.58,-0.58)
            .. controls (0.63,-0.24) and (0.36,-0.02) .. (0,-0.10)
            -- cycle;
    \end{scope}
\end{tikzpicture}%
}
\newcommand{\titre}{La dame et ses libert\'es}
\newcommand{\soustitre}{Cycle 3 et Cycle 4 · Fiche n\textsuperscript{o}\,012}

\fancyhead[C]{%
\raisebox{4pt}{%
\begin{minipage}[c]{0.15\textwidth}
    \centering
    \logowouf
\end{minipage}
\begin{minipage}[c]{0.62\textwidth}
    \centering
    {\Large\bfseries \titre\par}
    {\small\color{gray} \soustitre}
\end{minipage}
\begin{minipage}[c]{0.21\textwidth}
    \centering
    \qrcode[height=1.5cm]{https://site2wouf.fr/la_dame.php?t=c2.h2-b4-e7}\\[2pt]
    {\small\ttfamily\bfseries\color{red} DAME0012}
\end{minipage}%
}
}

\begin{document}
\newchessgame

\noindent Aux \'echecs, la \textbf{dame} est la pi\`ece la plus puissante : elle se d\'eplace comme la \textbf{tour} (lignes et colonnes) \emph{et} comme le \textbf{fou} (diagonales). Par exemple, depuis la case \textbf{d4}, elle peut aller sur les cases surlign\'ees : \texttt{a1, a4, a7, b2, b4, b6, c3, c4, c5, d1, d2, d3, d5, d6, d7, d8, e3, e4, e5, f2, f4, f6, g1, g4, g7, h4, h8}.
\begin{center}
  \chessboard[clearboard,showmover=false,pgfstyle=color,color=green!45,markfields={a1,a4,a7,b2,b4,b6,c3,c4,c5,d1,d2,d3,d5,d6,d7,d8,e3,e4,e5,f2,f4,f6,g1,g4,g7,h4,h8},setpieces={Qd4}]
\end{center}
\begin{enumerate}[label=\textbf{\arabic*.},leftmargin=*,itemsep=1.4ex]
  \item \textbf{Une dame en c2.} On pose une dame en \textbf{c2}. Sur quelles cases peut-elle aller ? Combien a-t-elle de libert\'es ?
  \item \textbf{Une enqu\^ete.} Une dame peut se rendre en \textbf{h2}, \textbf{b4} et \textbf{e7}. Sur quelle(s) case(s) est-elle situ\'ee ?
  \item \textbf{Les libert\'es selon la case.} \'Etudie, \`a l'aide d'un diagramme colori\'e et l\'egend\'e, le nombre de libert\'es de la dame \emph{en fonction de sa case de d\'epart}. Que remarques-tu ?
\end{enumerate}
\newpage
\section*{Corrig\'e}
\noindent\textbf{1.} La dame en c2 a \textbf{23 libert\'es} : \texttt{a2, a4, b1, b2, b3, c1, c3, c4, c5, c6, c7, c8, d1, d2, d3, e2, e4, f2, f5, g2, g6, h2, h7}.
\begin{center}
  \chessboard[clearboard,showmover=false,pgfstyle=color,color=green!45,markfields={a2,a4,b1,b2,b3,c1,c3,c4,c5,c6,c7,c8,d1,d2,d3,e2,e4,f2,f5,g2,g6,h2,h7},setpieces={Qc2}]
\end{center}
\smallskip\noindent\textbf{2.} Une dame qui peut se rendre en \textbf{h2}, \textbf{b4} et \textbf{e7} se trouve sur \textbf{d6} ou \textbf{h4}. Chacune \emph{voit} les trois cases par une ligne, une colonne ou une diagonale (les fl\`eches montrent les trajets).
\begin{center}
  \chessboard[clearboard,showmover=false,pgfstyle=color,color=yellow!70,markfields={h2},color=blue!35,markfields={b4},color=red!55,markfields={e7},setpieces={Qd6, Qh4},pgfstyle=straightmove,arrow=to,linewidth=0.13em,color=green!55!black,markmoves={d6-h2,d6-b4,d6-e7,h4-h2,h4-b4,h4-e7}]
\end{center}
\nopagebreak\begin{center}\footnotesize
\colorbox{yellow!70}{~~}~h2 \quad \colorbox{blue!35}{~~}~b4 \quad \colorbox{red!55}{~~}~e7 \quad \textcolor{green!55!black}{\textbf{\textrightarrow}}~trajets des dames vers les 3 indices
\end{center}
\smallskip\noindent\textbf{3.}
\begin{center}
\begin{tikzpicture}[scale=0.60,line join=round]
  \fill[red!0!yellow] (0,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,0.5) {21};
  \fill[red!0!yellow] (1,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,0.5) {21};
  \fill[red!0!yellow] (2,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (2.5,0.5) {21};
  \fill[red!0!yellow] (3,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (3.5,0.5) {21};
  \fill[red!0!yellow] (4,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (4.5,0.5) {21};
  \fill[red!0!yellow] (5,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (5.5,0.5) {21};
  \fill[red!0!yellow] (6,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,0.5) {21};
  \fill[red!0!yellow] (7,0) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,0.5) {21};
  \fill[red!0!yellow] (0,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,1.5) {21};
  \fill[red!33!yellow] (1,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,1.5) {23};
  \fill[red!33!yellow] (2,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (2.5,1.5) {23};
  \fill[red!33!yellow] (3,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (3.5,1.5) {23};
  \fill[red!33!yellow] (4,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (4.5,1.5) {23};
  \fill[red!33!yellow] (5,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (5.5,1.5) {23};
  \fill[red!33!yellow] (6,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,1.5) {23};
  \fill[red!0!yellow] (7,1) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,1.5) {21};
  \fill[red!0!yellow] (0,2) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,2.5) {21};
  \fill[red!33!yellow] (1,2) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,2.5) {23};
  \fill[red!67!yellow] (2,2) rectangle +(1,1);
  \node[font=\tiny,text=white] at (2.5,2.5) {25};
  \fill[red!67!yellow] (3,2) rectangle +(1,1);
  \node[font=\tiny,text=white] at (3.5,2.5) {25};
  \fill[red!67!yellow] (4,2) rectangle +(1,1);
  \node[font=\tiny,text=white] at (4.5,2.5) {25};
  \fill[red!67!yellow] (5,2) rectangle +(1,1);
  \node[font=\tiny,text=white] at (5.5,2.5) {25};
  \fill[red!33!yellow] (6,2) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,2.5) {23};
  \fill[red!0!yellow] (7,2) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,2.5) {21};
  \fill[red!0!yellow] (0,3) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,3.5) {21};
  \fill[red!33!yellow] (1,3) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,3.5) {23};
  \fill[red!67!yellow] (2,3) rectangle +(1,1);
  \node[font=\tiny,text=white] at (2.5,3.5) {25};
  \fill[red!100!yellow] (3,3) rectangle +(1,1);
  \node[font=\tiny,text=white] at (3.5,3.5) {27};
  \fill[red!100!yellow] (4,3) rectangle +(1,1);
  \node[font=\tiny,text=white] at (4.5,3.5) {27};
  \fill[red!67!yellow] (5,3) rectangle +(1,1);
  \node[font=\tiny,text=white] at (5.5,3.5) {25};
  \fill[red!33!yellow] (6,3) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,3.5) {23};
  \fill[red!0!yellow] (7,3) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,3.5) {21};
  \fill[red!0!yellow] (0,4) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,4.5) {21};
  \fill[red!33!yellow] (1,4) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,4.5) {23};
  \fill[red!67!yellow] (2,4) rectangle +(1,1);
  \node[font=\tiny,text=white] at (2.5,4.5) {25};
  \fill[red!100!yellow] (3,4) rectangle +(1,1);
  \node[font=\tiny,text=white] at (3.5,4.5) {27};
  \fill[red!100!yellow] (4,4) rectangle +(1,1);
  \node[font=\tiny,text=white] at (4.5,4.5) {27};
  \fill[red!67!yellow] (5,4) rectangle +(1,1);
  \node[font=\tiny,text=white] at (5.5,4.5) {25};
  \fill[red!33!yellow] (6,4) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,4.5) {23};
  \fill[red!0!yellow] (7,4) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,4.5) {21};
  \fill[red!0!yellow] (0,5) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,5.5) {21};
  \fill[red!33!yellow] (1,5) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,5.5) {23};
  \fill[red!67!yellow] (2,5) rectangle +(1,1);
  \node[font=\tiny,text=white] at (2.5,5.5) {25};
  \fill[red!67!yellow] (3,5) rectangle +(1,1);
  \node[font=\tiny,text=white] at (3.5,5.5) {25};
  \fill[red!67!yellow] (4,5) rectangle +(1,1);
  \node[font=\tiny,text=white] at (4.5,5.5) {25};
  \fill[red!67!yellow] (5,5) rectangle +(1,1);
  \node[font=\tiny,text=white] at (5.5,5.5) {25};
  \fill[red!33!yellow] (6,5) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,5.5) {23};
  \fill[red!0!yellow] (7,5) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,5.5) {21};
  \fill[red!0!yellow] (0,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,6.5) {21};
  \fill[red!33!yellow] (1,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,6.5) {23};
  \fill[red!33!yellow] (2,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (2.5,6.5) {23};
  \fill[red!33!yellow] (3,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (3.5,6.5) {23};
  \fill[red!33!yellow] (4,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (4.5,6.5) {23};
  \fill[red!33!yellow] (5,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (5.5,6.5) {23};
  \fill[red!33!yellow] (6,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,6.5) {23};
  \fill[red!0!yellow] (7,6) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,6.5) {21};
  \fill[red!0!yellow] (0,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (0.5,7.5) {21};
  \fill[red!0!yellow] (1,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (1.5,7.5) {21};
  \fill[red!0!yellow] (2,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (2.5,7.5) {21};
  \fill[red!0!yellow] (3,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (3.5,7.5) {21};
  \fill[red!0!yellow] (4,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (4.5,7.5) {21};
  \fill[red!0!yellow] (5,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (5.5,7.5) {21};
  \fill[red!0!yellow] (6,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (6.5,7.5) {21};
  \fill[red!0!yellow] (7,7) rectangle +(1,1);
  \node[font=\tiny,text=black] at (7.5,7.5) {21};
  \draw[gray!55,line width=0.3pt] (0,0) grid (8,8);
  \draw[black,line width=0.7pt] (0,0) rectangle (8,8);
  \node[font=\tiny] at (0.5,-0.32) {a};
  \node[font=\tiny] at (1.5,-0.32) {b};
  \node[font=\tiny] at (2.5,-0.32) {c};
  \node[font=\tiny] at (3.5,-0.32) {d};
  \node[font=\tiny] at (4.5,-0.32) {e};
  \node[font=\tiny] at (5.5,-0.32) {f};
  \node[font=\tiny] at (6.5,-0.32) {g};
  \node[font=\tiny] at (7.5,-0.32) {h};
  \node[font=\tiny] at (-0.32,0.5) {1};
  \node[font=\tiny] at (-0.32,1.5) {2};
  \node[font=\tiny] at (-0.32,2.5) {3};
  \node[font=\tiny] at (-0.32,3.5) {4};
  \node[font=\tiny] at (-0.32,4.5) {5};
  \node[font=\tiny] at (-0.32,5.5) {6};
  \node[font=\tiny] at (-0.32,6.5) {7};
  \node[font=\tiny] at (-0.32,7.5) {8};
\end{tikzpicture}
\end{center}
\nopagebreak\begin{center}\footnotesize
\colorbox{red!0!yellow}{~~}~21 \quad \colorbox{red!33!yellow}{~~}~23 \quad \colorbox{red!67!yellow}{~~}~25 \quad \colorbox{red!100!yellow}{~~}~27 \quad libert\'es
\end{center}
\noindent La dame cumule la tour (14 partout) et le fou (7 \`a 13) : ses libert\'es varient de \textbf{21} dans un coin \`a \textbf{27} au centre, en \textbf{anneaux} comme le fou mais toujours \textbf{14 de plus}.
\end{document}
