# Given a 7x7 grid, what moves need to be made to get two agents on their respective opposite sides of the grid on the diagonal?

Say I had the following 7x7 grid and two agents on the grid facing one another as shown.

• The agents can follow the following commands: moveForward, turnRight, turnLeft.
• The agents have to follow the same set of instructions.
• Any instruction that would result in two agents sharing the same square will be ignored.
• Any instruction that would result in the two agents colliding/phasing through one another would be ignored.
• Any instruction that would cause an agent to leave the board would be ignored by that agent. (e.g. if you gave the instructions turnRight and moveForward, the green would turn right and move forward but the purple would simply turn right and remain in place)

What set of instructions would get the green agent on the green square and the purple agent on the purple square?

• What happens if agents collide? (Meaning, what happens if A would go to B's square, and B would go to A's square, simultaneously? Do they phase through each other? After all, they're not going to end up on the exact same square) – Avi Jan 16 '20 at 18:31
• As the question is currently stated phasing would be fine since, after the move is made, they wouldn't be sharing a square. However when I thought of the question, collisions wouldn't be possible. I'll edit the question so that commands that result in collisions wouldn't be followed – Alfonso Canady Jan 16 '20 at 18:36