# A robot moving on a grid

In the spirit the question I propose the puzzle:

A robot is placed on a vertex of a grid. At each move the robot must take three steps along the edge of the grid. After each step the robot must turn right. Lengths of each step are $$a$$, $$b$$, and $$c$$ edges respectlly, $$a, b, c>0$$. After each move the robot must turn right too. The robot can revisit vertices and edges. After four moves the robot must return to the start vertex and stop.

What is the number of revisited vertices?

A vertex can be revisited two times at least, then does it count as just one revisited vertex.

Edit.

Here is an example of one move for $$a=1$$, $$b=2$$, and $$c=3$$. • Can you give an example to illustrate the problem, e.g. the case $a, b, c = 1, 2, 3$ or any case that is easy to work out? Aug 26, 2020 at 3:59
• @WhatsUp, I have added an example.
– Nick
Aug 26, 2020 at 4:25
• If I understand correctly, then this is just one "move", and you want to repeat this four times so that it returns to the original position, right? There is one more point that is not clear to me: if a vertex is revisited three or more times, then does it count as just one revisted vertex, or every revisit counts once? Aug 26, 2020 at 4:31
• Sorry but wha do you mean by after each move? Aug 26, 2020 at 4:33
• What is the difference between vertices and edges Aug 26, 2020 at 4:35

After $$4$$ moves or $$12$$ steps the robot should have drawn something like a "flower".

It doesn't matter in which order $$a, b, c$$ are, since the trajectory forms a loop. A permutation of $$a, b, c$$ amounts to starting somewhere else on the loop or mirroring the loop. So wlog let's assume $$a \le b \le c$$.

Case 1.

If $$a+b \lt c$$ then the loop forms something like an apple command key ⌘. It has $$4$$ revisited vertices (i.e. grid points).

Case 2.

If $$a+b = c$$ then the path forms a "windmill" pattern with the loop crossing the center $$4$$ times. The path overlaps on the horizontal and vertical axes on a lengh $$a$$ in $$4$$ directions from the center. That makes $$4a+1$$ revisited grid points.

Case 3.

If $$a+b \gt c$$ with $$a \lt b \lt c$$ then the robot draws a four-fold knot pattern that crosses $$8$$ times. So $$8$$ revisited grid points.

Case 4.

If $$a+b \gt c$$ with $$a = b \lt c$$ then it makes a square grid of $$3 \times 3$$ cells where the center segment of the borders is visited twice and has length $$c - 2a$$. That makes $$4(c - 2a + 1)$$ revisited grid points.

Case 5.

If ($$a+b \gt c)$$ with $$a \lt b = c$$ then it forms something like a Swiss cross with a center square revisited. That should be $$4 \cdot a$$ revisited grid points.

Case 6.

If ($$a+b \gt c$$) with $$a = b = c$$ then we also have $$4a$$ revisited grid points. (but this time revisted and re-revisited)

I assume $$a > 0$$. This would be another special case with subcases.

• Good work! By the way why is a square grid of 3x3 cells?
– Nick
Aug 26, 2020 at 7:50
• I see. I am forgetting a number of special cases. For instance a=b=c. Aug 26, 2020 at 8:23
• I am looking on the Case 2: rot13("Pbhyq lbh rkcynva ubj gur rdhngvba $4n+1$ jnf bognvarq? V guvax va guvf pnfr jr unir $5$ erivfrq iregvprf sbe nal $n>0$.")
– Nick
Aug 27, 2020 at 5:27
• @Nick The repeated vertices form a cross with 4 arms of length $a$ around the central vertex that is visited 4 times. With each move, the stretch of distance $c$ goes along two arms of the cross. Aug 27, 2020 at 8:34
• @JaapScherphuis, this works if $a=1$ only. If $a \neq 1$ then how to obtain $4a+1$ revisited grid points? I think in the case 2 robot will have $5$ revisited grid points only.
– Nick
Aug 27, 2020 at 8:40