Update solution for 2023/17
Represent state as the most recent direction moved and the number of
times we have moved in that direction sequentially, since that's the
only information that is actually relevant (essentially adding a 3rd
dimension to the traversal where we move down the Z-axis while moving
in the same direction and then pop up to layer z=0 when turning.)