Global Positioning System Reference
In-Depth Information
13.4.2 AIRunner
The player running away from the chasers is a good starting point, since
he always knows the current game status, i.e., the other players' positions,
while the chasers can only see the runner every other round and have to
make assumptions about his status.
With the new AIRunner created in the last section, the programmer has
a working client program with only two methods
public void init( GameSet gameSet )
protected Integer getDestination()
to initialize the player with game information and to actually make the
next move. The rest of the interaction is implemented in the LCPlayer .
For a quick implementation, a heuristic evaluation will be placed in
the method getDestination() with the time constraint of getTimeToMove()
seconds in the server settings. If all players were to use this mechanism, the
game rounds would implicitly indicate the individual decision times. The
runner always begins the evaluation with the chasers' constellation when
he is requested to make his move. The initial station is randomized and
can be hard-coded to analyze special situations.
The decision-making in this simple game context can be based on the
chasers' stations and the board. The runner does not need to distinguish
the chasers actual ID. The LCPlayer keeps track of the game and provides
the member variables destinationsplayersboard . With
moveStations = new ArrayList<Integer>
( board.getDestinations(myOrigin,1));
chasersStations = new ArrayList<Integer>
( destinations.values() );
the AI runner has gathered all necessary information: the chasers' sta-
tions as input parameters, the list of all possible destinations (result set)
to evaluate, and the board itself to validate the strategic quality of each
station.
A heuristic search should store intermediate results in case time runs
out. The initial value is randomized:
moveStations.get( generate.nextInt( moveStations.size() ));
Since the destinations provided by the LCPlayer include the runner itself, it
has to be removed before evaluating. According to the rules, a runner can
not move onto a chaser's station, so those stations can be removed from the
move destinations. Also, the chasers' neighboring stations can be removed.
Otherwise, the runner will be defeated in the next round:
removeChaseStations ( moveStations, chasersStations );
if ( moveStations.isEmpty() )
 
Search WWH ::




Custom Search