explore
public void explore(ExplorationState state)
Explore the cavern, trying to find the
orb in as few steps as possible. Once you find the
orb, you must return from the function in order to pick
it up. If you continue to move after finding the orb rather
than returning, it will not count.
If you return from this function while not standing on top of the orb,
it will count as a failure.
There is no limit to how many steps you can take, but you will receive
a score bonus multiplier for finding the orb in fewer steps.
At every step, you only know your current tile's ID and the ID of all
open neighbor tiles, as well as the distance to the orb at each of these tiles
(ignoring walls and obstacles).
In order to get information about the current state, use functions
getCurrentLocation(), getNeighbors(), and getDistanceToTarget() in ExplorationState.
You know you are standing on the orb when getDistanceToTarget() is 0.
Use function moveTo(long id) in ExplorationState to move to a neighboring
tile by its ID. Doing this will change state to reflect your new position.
A suggested first implementation that will always find the orb, but likely won't
receive a large bonus multiplier, is a depth-first search.
- Parameters:
state
- the information available at the current state