Editorial for ECOO '13 R2 P3 - Last Robot Standing
Submitting an official solution before solving the problem yourself is a bannable offence.
The only way to do this is to simulate the game for each possible starting position and then keep track of the ones that lead to a win for your robot. Use a two-dimensional array for the board but don't forget to re-initialize it for each run.
Keeping track of the players can be a bit tricky. You need some way to keep track of each robot's position (an array or set of arrays will do this) as well as where each robot is at in using its strategy. One way to do this is by using an array that indicates the current position inside the strategy of each robot. Another way is to represent the strategies as strings, then remove each move as you make it and concatenate it onto the end of the string again.
The fact that robots are not removed until their next turn is not really important. It makes no difference to the outcome of the game if you remove the robots on the turn they box themselves in or on their next turn as long as you apply the rule consistently.
Comments