Roboti
In the computer game Robots, the player tries to escape mad robots. There are many robots against the lone player, but their movement is predictable and the player can take advantage of that. The game is played on a board of size R×[]. The following 5 steps are repeated:
1. The player moves in one of eight directions (horizontally, vertically or diagonally) or stays in the same cell.
2. If the player moves to a cell occupied by a robot, the game ends and the player loses.
3. Every robot moves in one of eight directions, to the neighbouring cell closest to the player.
More precisely, the robot attempts to minimize the value of |r1−r2| + |s1−s2|, where (r1, s1) and (r2, s2) are the positions of the player and robot.
4. If any robot has entered the player's cell, the game ends and the player loses.
5. If two or more robots have entered the same cell, a large explosion destroys all the robots in that cell.
You will be given the starting location of the player, the locations of all robots and the moves the player makes. If the player makes all his moves and survives, you are to output the state of the board after all his moves. Otherwise, output how many moves he was able to make.
[c]4 5
I....
.....
.R.R.
.....
6
Output:
.I...
.RR..
.....
..... 9 10
..........
.........R
..........
R.........
R...I.....
R.........
..........
.........R
....R.....
5558888Output:
....I.....
....R.....
..........
..........
..........
..........
..........
..........
..........12 8
...I....
........
........
........
........
RR......
......RR
R......R
........
........
........
...R....
66445394444162Output:
kraj 11Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.