| ||You are trapped in a room full of zombies. Luckily the room is pitch black and, while the zombies can't see, you have night vision goggles. To get out though you will have to be careful, since bumping into a zombie is hazardous to your health.|
More specifically, each zombie will have x and y coordinates between 0 and 99 inclusive. You start at (0,0). If you can get to (99,99), you can take an elevator to safety. You may not leave the room any other way. Get there as fast as you can!
You must implement a method move. This method takes two ints, zx and zy, giving the locations of all the zombies, along with ints x and y giving your location. Your method should return "S" to stand still, or "R", "L", "U", or "D" for the four cardinal directions, and "RU", "RD", "LU", or "LD" for the four diagonal directions:
LU U RU
L S R
LD D RD
Moving right increases your x coordinate, while moving down increases your y coordinate.
After each of your moves, the zombies will all move randomly. Each zombie will chose a random direction (from the 9 including no move) and attempt to move in that direction. If a zombie wants to move outside of the box defined by (0,0)-(99,99) it will stay where it is instead. Note that while the initial locations of all the zombies are distinct, they will not stay that way -- multiple zombies may occupy the same location.
Each test case will be generated by first choosing a zombie density in [0.05,0.15]. All locations with x or y at least 5 will then contain one initial zombie with probability equal to the density.
The simulation will be run for a maximum of 10,000 time steps. You may run into zombies at most 10 times -- the 11th one will kill you. If you fail to reach the exit but you manage to stay alive for T time steps, your score will be T. If you make it to the exit at time T, your score will be 30000 - 2 * T plus 1000 per unused life. In other words, you have 10,000 steps to escape, and you get a bonus of 2 points for each time step you don't need to use. Your final score will simply be the average of your individual scores.
A simple visualizer is provided (with source). To use it you need to write a program which communicates via standard IO. Your main method should first read in N, the number of zombies. For each call to move, you should read in N integers for zx, then N integers for zy, and finally two integers for x and y. You should simply output the move you would return. You can run it with something like:
java -jar Zombie.jar "java Zombie" -delay 1 -seed 1
"java Zombie" is the executable, and should be replaced with whatever command will run your program. The -delay parameter sets the delay in milliseconds between moves. The -seed parameter specifies the random number generator seed (the examples are 1-10). There is also a -novis parameter which causes the simulation to be run with the visualization. Be careful not to output anything other than your moves to standard out. Standard error may be used for debugging purposes.
|Parameters:||int, int, int, int|
|Method signature:||String move(int zx, int zy, int x, int y)|
|(be sure your method is public)|
|-||If a move put make one of your coordinates less than 0 or more than 99, that coordinate will remain at 0 or 99.|
|-||You can lose more than one life in a single turn. If you run into a zombie, and that zombie stands still, for instance, or if multiple zombies run into you.|
|-||The time limit is 10 seconds and the memory limit is 1024M.|
Returns: "seed = 1<br>
p = 0.10890396204102991"
Returns: "seed = 2<br>
p = 0.09403548040336274"
Returns: "seed = 3<br>
p = 0.13169741375715854"
Returns: "seed = 4<br>
p = 0.13715765988441714"
Returns: "seed = 5<br>
p = 0.09333321007791222"
Returns: "seed = 6<br>
p = 0.14836381255813919"
Returns: "seed = 7<br>
p = 0.08632318507245296"
Returns: "seed = 8<br>
p = 0.09103746206340194"
Returns: "seed = 9<br>
p = 0.1176445441578173"
Returns: "seed = 10<br>
p = 0.07727915503616416"
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2020, TopCoder, Inc. All rights reserved.