\myheading{Numberlink (\ac{AKA} Flow Free) puzzle (Z3Py)} \renewcommand{\CURPATH}{puzzles/numberlink/Z3} You probably saw Flow Free puzzle: \begin{figure}[H] \centering \includegraphics[scale=0.3]{\CURPATH/flow-extreme-11-11.png} \caption{} \end{figure} I'll stick to Numberlink version of the puzzle. This is the example puzzle from Wikipedia: \begin{figure}[H] \centering \includegraphics[scale=0.3]{\CURPATH/424px-Numberlink_puzzle.png} \caption{} \end{figure} This is solved: \begin{figure}[H] \centering \includegraphics[scale=0.3]{\CURPATH/424px-Numberlink_puzzle_solution.png} \caption{} \end{figure} See also: \url{https://en.wikipedia.org/wiki/Numberlink}, \url{https://en.wikipedia.org/wiki/Flow_Free}. The code: \setmonofont{\MonoFontForBoxChars} \lstinputlisting[basicstyle=\ttfamily\small,style=custompy]{\CURPATH/numberlink.py} \setmonofont{\MonoFontMain} The solution: \lstinputlisting{\CURPATH/solution.txt} \begin{figure}[H] \centering \includegraphics[scale=1]{\CURPATH/solution.png} \caption{The solution} \end{figure}