\documentclass[
	solutions,
	hidewarning,
	singlenumbering,
	nopagenumber
]{../../resources/ormc_handout}
\usepackage{../../resources/macros}


\title{Warm-Up: Conway's Box}
\subtitle{Prepared by \githref{Mark} on \today. \\ Based on a true story.}

\usetikzlibrary{shapes}
\tikzset{
	iso/.style={kite, draw, kite vertex angles=120,  minimum size=1cm, outer sep=0pt}
}


\newcommand{\isogrid}[2]{
\foreach \i [count=\row from 0, remember=\row as \lastrow (initially 0)] in {0,...,#1}{
	\foreach \j [count=\col from 0, remember=\col as \lastcol (initially 0)] in {0,...,#2}{
		\ifnum\row=0
			\ifnum\col=0
				\node[iso] (\row-\col) {};
			\else
				\node[iso, anchor=left vertex] (\row-\col) at (\row-\lastcol.right vertex) {};
			\fi
		\else
			\ifnum\col=0
				\node[iso, anchor=upper vertex] (\row-\col) at (\lastrow-\col.lower vertex) {};
			\else
				\node[iso, anchor=left vertex] (\row-\col) at (\row-\lastcol.right vertex) {};
			\fi
		\fi
		}
	}
	\draw (0-0.left vertex)--(#1-0.left vertex);
	\foreach \i in {0,...,#2}{
	\draw (0-\i.upper vertex)--(#1-\i.lower vertex);
	\draw (0-\i.right vertex)--(#1-\i.right vertex);
}
}


\begin{document}

	\maketitle

	\problem{}
	Pack the following pieces into a $5\times5\times5$ box.\par
	\begin{itemize}
		\item One $2 \times 2 \times 2$
		\item Two $1 \times 2 \times 2$
		\item Three $1 \times 1 \times 3$
		\item Thirteen $1 \times 2 \times 4$
	\end{itemize}


	\begin{solution}
		\begin{center}
			\includegraphics[width=10cm,page=1]{conway_sol.pdf}
		\end{center}
	\end{solution}

	\vfill
	\pagebreak

	\begin{center}
		\null\vfill
		\begin{tikzpicture}
			\isogrid{20}{7}
		\end{tikzpicture}
		\vfill\null
	\end{center}

\end{document}


% \documentclass[tikz,border=2mm]{standalone}
% \usetikzlibrary{shapes}
%
% \tikzset{
%     iso/.style={kite, draw, kite vertex angles=120,  minimum size=1cm, outer sep=0pt}
% }
%
% \newcommand{\isogrid}[2]{
% \foreach \i [count=\row from 0, remember=\row as \lastrow (initially 0)] in {0,...,#1}{
%     \foreach \j [count=\col from 0, remember=\col as \lastcol (initially 0)] in {0,...,#2}{
%         \ifnum\row=0
%             \ifnum\col=0
%                 \node[iso] (\row-\col) {\row-\col};
%             \else
%                 \node[iso, anchor=left vertex] (\row-\col) at (\row-\lastcol.right vertex) {\row-\col};
%             \fi
%         \else
%             \ifnum\col=0
%                 \node[iso, anchor=upper vertex] (\row-\col) at (\lastrow-\col.lower vertex) {\row-\col};
%             \else
%                 \node[iso, anchor=left vertex] (\row-\col) at (\row-\lastcol.right vertex) {\row-\col};
%             \fi
%         \fi
%         }
%     }
% \draw (0-0.left vertex)--(#1-0.left vertex);
% \foreach \i in {0,...,#2}{
%     \draw (0-\i.upper vertex)--(#1-\i.lower vertex);
%     \draw (0-\i.right vertex)--(#1-\i.right vertex);
% }
% }
%
% \begin{document}
% \begin{tikzpicture}
%
% \isogrid{19}{9}
% \begin{scope}[line width=2pt]
% \draw (1-3.right vertex)--(3-5.right vertex)--(7-1.right vertex)--(5-0.left vertex)--cycle;
% \draw (5-0.left vertex)--(13-0.left vertex)--(15-1.right vertex)--(7-1.right vertex);
% \draw (3-5.right vertex)--(5-5.right vertex)--(7-7.right vertex)--(10-7.right vertex)--(11-8.right vertex)--(12-7.right vertex)--(13-8.right vertex)--(15-7.upper vertex)--(13-5.upper vertex)--(10-5.upper vertex)--(8-3.upper vertex)--(5-5.right vertex);
% \draw (9-5.lower vertex)--(7-7.right vertex);
% \draw (12-5.lower vertex)--(10-7.right vertex);
% \draw (11-8.right vertex)--(16-8.right vertex)--(17-7.lower vertex)--(13-3.lower vertex)--(15-1.right vertex);
% \draw (7-3.lower vertex)--(13-3.lower vertex);
% \draw (14-7.lower vertex)--(17-7.lower vertex);
%
% \draw[dashed] (13-0.left vertex)--(9-3.right vertex)--(1-3.right vertex);
% \draw[dashed] (9-3.right vertex)--(14-8.right vertex)--(15-7.right vertex)--(16-8.right vertex);
% \draw[dashed] (12-7.right vertex)--(15-7.right vertex);
% \end{scope}
% \end{tikzpicture}
%
% \end{document}