Problem: A robot wanders around a 2-dimensional grid. Starting at $(0, 0)$, he is allowed 4 different kinds of steps:
- $(+2, -1)$
- $(+1, -2)$
- $(+1, +1)$
- $(-3, 0)$
He is trying to get to $(0, 2)$.
(a) Describe a state machine of this problem.
(b) Will he be able to get to $(0, 2)$? Find a path that takes him there or use the Invariant principle to prove that no such path exists.
I'm not entirely sure on what the Invariant principle is, firstly. Secondly, what I have as a description of the state machine:
Start state ::= $(0, 0)$
Transitions ::= $\{(x, y) \to (x+2, y-1)\} \cup \{(x, y) \to (x+1, y-2)\} \cup \{(x, y) \to (x+1, y+1)\} \cup \{(x, y) \to (x-3, y)\}$
So far all I have is my argument that to get to $(0, 2)$ the robot must first get to a coordinate $q$ such that if $(0, 2)$ is $r$, then $q \to r$. So, if he can get to a coordinate that can get to $(0,2)$ he can therefore get to $(0,2)$. I did out the 4 cases, and found that $(-2, 3), (-1, 4), (-1, 1), (3, 2)$ all can get to $(0, 2)$ in one move. However, because there were so many different steps, I didn't find a way to get to those 4 (or 5) spaces in a reasonable amount of guess-and-check moves, nor could I see a distinct pattern. I assume I have to prove that no such path exists, I'm just not sure how.
The robot can go to positions $(x,y)$ where $x-y$ is a multiple of 3 only. Note that this invariant holds at the origin, and is preserved by each of the four steps. Since $(0,2)$ does not satisfy this property, the robot cannot get there.