\section{Implementation}
\subsection{Screen encoding}
When parsed the sokoban screen is stripped of all walls and unreachable empty
-spaces are removed.
+spaces are removed. Moreover, a screen is rejected if either there are no
+boxes, there is no agent or the number of boxes is not equal to the number of
+targets.
Let $T=\{free,box,target,agent,targetagent,targetbox\}$ be the set of possible
states of a tile. Tiles are numbered and thus a sokoban screen is the set $F$
(targetagent, i_2, i_3) & \text{if } & i_1=targetagent\\
\end{array}\right.$$
+\subsection{Goal encoding}
+Encoding the goal state is very trivial. Just make sure all $target$ tiles are
+$targetbox$ tiles.
+
\subsection{Example}
-For example, take the toy screen shown in Listing~\ref{lst:toy}. When the
-screen is parsed the unreachable space is first removed by detecting reachable
-space with the flood fill algorithm. This results in the minimized screen
-listed in Listing~\ref{lst:toy2}.
+For example, take the toy screen shown as the first representation in
+Listing~\ref{lst:toy}. When the screen is parsed the unreachable space is first
+removed by detecting reachable space with the flood fill algorithm. This
+results in the second representation in Listing~\ref{lst:toy}.
\lstinputlisting[label={lst:toy},caption={Example screen}]{toy.screen}
-\lstinputlisting[label={lst:toy2},caption={Example screen}]{toy2.screen}
\subsubsection{Encoding}
To encode the screen the tiles are numbered from left to right from top to