% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
\documentclass[
	solutions,
	shortwarning
]{../../resources/ormc_handout}

\usepackage{chessfss}
\usepackage{chessboard}
\usepackage{xcolor}
\usepackage{anyfontsize}
\usepackage{afterpage}
\usepackage[hang]{footmisc}


\def\stars#1#2{%
	\def\oncolor{\color{purple}}%
	\def\offcolor{\color{black!40!white}}%
	%
	\count255=1%
	\count254=#2%
	\advance\count254 by -1%
	\ifnum #1 > 0
		% The $$ are required around \bigstar.
		% the special \odot chess piece breaks
		% star sizing if they are ommited.
		\loop
			{\oncolor $\bigstar$}%
		\ifnum\count255 < #1
		\advance\count255 by 1
		\repeat%
	\else%
		{\oncolor $\bigstar$}%
	\fi%
	%
	\ifnum \count255 < #2%
		\loop
			{\offcolor $\bigstar$}%
		\ifnum\count255 < \count254
		\advance\count255 by 1
		\repeat%
	\fi%
}

\def\difficulty#1#2{
	\textbf{Difficulty:} \stars{#1}{#2} \par
	\vspace{1mm}
}

\def\difficultynote#1#2#3{
	\textbf{Difficulty:} \stars{#1}{#2} ~ #3\par
	\vspace{1mm}
}


\setchessboard{
	showmover=false,
	borderwidth=0.5mm,
	label=false,
	labelleft=true,
	labelbottom=true,
	normalboard,
	hlabelformat=\arabic{ranklabel},
	vlabelformat=\Alph{filelabel}
}

\makeatletter
\cbDefineNewPiece{white}{U}
{\raisebox{1.75mm}{\cfss@whitepiececolor
$\odot$}}
{\BlackEmptySquare%
\makebox[0pt][r]{\cfss@whitepiececolor
\raisebox{1.75mm}{\makebox[1em]{$\odot$}}}}

\long\def\manyboards#1{
	\if@solutions
		\chessboard[setpieces = {#1}]
		\hfill
		\chessboard[setpieces = {#1}]
	\else
		\vfill
		\chessboard[setpieces = {#1}]
		\hfill
		\chessboard[setpieces = {#1}]
		\vfill
		\chessboard[setpieces = {#1}]
		\hfill
		\chessboard[setpieces = {#1}]
	\fi
}
\makeatother




\uptitlel{Advanced 2}
\uptitler{Fall 2023}
\title{Retrograde Analysis}
\subtitle{
	Prepared by Mark on \today{} \\
	Based on books\footnotemark{} by Raymond Smullyan
}

\begin{document}

	\maketitle

	\footnotetext[1]{
		Most of the easy problems in this handout are from \textit{The Chess Mysteries of Sherlock Holmes}.\\
		The rest are from \textit{The Chess Mysteries of the Arabian Knights}.
	}


	\input{parts/intro}


	\section{Simple problems}
	\input{parts/easy}


	\section{Harder problems}
	\input{parts/medium}

	\section{Very difficult problems}
	\input{parts/hard}

	\chessboard \hfill \chessboard \par
	\chessboard \hfill \chessboard \par
	\chessboard \hfill \chessboard \par
\end{document}