de.uni_paderborn.robots.robot.group10
Class Map

java.lang.Object
  |
  +--de.uni_paderborn.robots.robot.group10.Map

public class Map
extends java.lang.Object

Automatically creates a map of the arena while the robot walks through it.


Inner Class Summary
 class Map.Coordinate
          Stores x and y coordinates and area information (when robot uses a wormhole).
protected  class Map.DijDistanceComparator
          Implements an order for MapItems based on their BfsDistance.
 class Map.ShortestPath
          Class for storing paths created by Map.findShortestPath()
 
Field Summary
static int ALREADY_THERE
          Error code returned by getPathError().
private  int areaCounter
           
private  boolean areasJoined
          Is set to true exactly in the round, in which two different areas could be joined because a position had been found that is common to both areas.
static int CARD_BLOCKS
          Error code returned by getPathError().
(package private) static int DONT_USE_RECENT_CARDS
          Flag for findShortestPath() During searching the path do not go over cards the robot has found during the last 10 rounds.
static int ENERGY_TOLERANCE
          The robot won't try to go paths that are not within getEnergy() - ENERGY_TOLERANCE
private  boolean energyKnown
          Is set to true when robot finds an energy source (recharger)
private  boolean exitKnown
          Is set to true when robot finds the exit
(package private) static int FORCE_EXPLORING
          Flag for findShortestPath() Priorize MapItems which have the most NOT_VISITED neighbours.
private  int gameRound
          Stores the number of the game round currently in progress.
private  int horizontalCycleSize
          Stores the size of a horizontal cycle in the arena.
static int INVALID
          Error code returned by getPathError() This path does not is not valid any more
private  java.util.Hashtable itemCoordinateTable
          Datastructure to keep all map items quickly accessible by their coordinate
private  java.util.TreeMap itemTreeMap
          Datastructure to keep all map items quickly accessible by their id
static int MAX_DISTANCE_EXCEEDED
          Error code returned by getPathError().
static int NORTH
          Defines the 6 direction in the robot's world.
static int NORTH_EAST
          Defines the 6 direction in the robot's world.
static int NORTH_WEST
          Defines the 6 direction in the robot's world.
static int NOT_FOUND
          Error code returned by getPathError().
(package private)  int notVisitedNeighbours
          saves the number of the neighbours which are not visited
static int OKAY
          Error code returned by getPathError().
private  int pathError
          If any of the methods dealing with shortest paths fails, it sets this value to an error code explaing the reason of the failure.
private  int postWormholeUsageState
          For internal use of postWormholeUsage().
static int PROGRAM_BUG
          Error code returned by getPathError().
private  java.util.Random rand
          Random number generator used by the shortest path methods.
private  CardFinder robot
          The robot that uses this map
static int ROBOT_BLOCKS
          Error code returned by getPathError().
private  int sawKnownFields
          For keeping statistics how many fields have been sawn more than once, and thus redundantly.
static int SOUTH
          Defines the 6 direction in the robot's world.
static int SOUTH_EAST
          Defines the 6 direction in the robot's world.
static int SOUTH_WEST
          Defines the 6 direction in the robot's world.
private  int stepsToRecharger
          The distance to the next recharger estimated by isRechargerGettingFar()
(package private) static int STOP_IN_FRONT_OF_ITEM
          Flag for findShortestPath() Does not go directly onto field which contains the item, but stops in front of it, when the robot looks at it.
static int UNUSED_WORMHOLES
          Error code returned by getPathError(): There are no unknown fields, but unused wormholes
(package private) static int USE_NOT_VISITED
          Flag for findShortestPath() Also used fields marked as NOT_VISITED during the search.
private  MapItem usedWormhole
          usesWormhole() stores here the wormhole to be used.
private  int verticalCycleSize
          Stores the size of a vertical cycle in the arena.
static int VIA_RECHARGER
          Error code returned by getPathError().
private  int whenCheck
          This value determines how often the shortest path to the recharger is actually calculated by isRechargerGettingFar() and not estimated.
static int WORMHOLE_WAS_BLOCKED
          Error code returned by getPathError(): The used wormhole was blocked.
private  boolean wormholeKnown
          Is set to true when robot finds a wormhole
 
Constructor Summary
Map()
          Creates and initializes a new map object
 
Method Summary
private  int addAdjacentItemsToQueue(MapItem mapItem, int predecessorDirection, MapItemMatcher mapItemMatcher, java.util.TreeSet queue, int addedToQueue)
          Adds add items linked to the given mapItem to the priority queue of the dijstra algorithm.
 void addMapItem(MapItem mapItem)
          Add a MapItem to the internal lists.
private  void checkCyclicArena(MapItem mapItemHere, MapItem mapItemNeighbour, int direction)
          Checks whether the MapItem the robot sits on and the MapItem the robot looks at indicates a cyclic arena.
private  int countNotVisitedNeighbours(MapItem mapItem)
          Method the determine the number of the not visited neighbours
 MapItem findMapItemByCoordinate(Map.Coordinate coordinate)
          Searches all known map items for the map item with the given coordinate
 MapItem findMapItemById(int id)
          Searches all known map items for the map item with the given id
 Map.ShortestPath findShortestPath(MapItemMatcher mapItemMatcher, int maxDistance, int flags)
          Tries to find a shortest path that is at most maxDistance steps long to a map item that can be specified using the mapItemMatcher.
 MapItem getCurrentMapItem()
          Returns the map item the robot currently sits on.
 int getGameRound()
          Get the number of the game round currently in progress.
 int getHorizontalCycleSize()
          Read access method for horizontalCycleSize
 MapItem getMapItemInFront()
          Returns the map item the robot currently looks at.
 MapItem getMapItemLeft()
          Returns the map item to the left of the robot (relative to robot's direction).
 MapItem getMapItemRight()
          Returns the map item to the right of the robot (relative to robot's direction).
 int getPathError()
          If any of the methods dealing with shortest paths fails, this method can be used to obtain an error code explaing the reason of the failure.
 int getVerticalCycleSize()
          Read access method for verticalCycleSize
 CardFinder getVirtualRobot()
          Get the robot that uses this map.
 boolean isEnergyKnown()
          Checks whether the robot has already found an energy source (recharger) during the arena exploration.
 boolean isExitKnown()
          Checks whether the robot has already found the exit during the arena exploration.
 boolean isRechargerGettingFar()
          isRechargerGettingFar() tells the robot in a fast way, whether the next recharger is dangerously too far away.
 boolean isWormholeKnown()
          Checks whether the robot has already found a wormhole during the arena exploration.
private  void joinAreas(MapItem mapItemHere, MapItem mapItemNeighbour, int direction)
          joinAreas() is called when the trackPosition() Method finds two neigbour fields which belong to different mapping areas.
private  void joinMapItemLinks(MapItem mapItem, MapItem mapItemRemove)
          Joins two MapItems into one.
static int oppositeDirection(int direction)
          Rotates a given direction value by 180 degrees.
private  java.util.LinkedList performDij(MapItemMatcher mapItemMatcher, MapItem startMapItem, int maxDistance, int flags)
          Searches for the nearest map item that matches with the specified search criteria.
 AbstractRobotAction postWormholeUsage()
          This method tells the map that the robot has just passed a wormhole.
 boolean preWormholeUsage()
          This method tells the map that the robot is about to use a wormhole.
 void printMap()
          Debug code: Prints an ASCII version of the map to the terminal
 void removeMapItem(MapItem mapItem)
          Removes a given MapItem from the internal lists.
static int rotateDirectionLeft(int direction)
          Rotates a given direction value by 90 degrees to the left.
static int rotateDirectionRight(int direction)
          Rotates a given direction value by 90 degrees to the right.
 void setHorizontalCycleSize(int horizontalCycleSize)
          Write access method for horizontalCycleSize
 void setNotVisitedNeighbours(int value)
          Method to set the number of the not-visited neighbours
 void setVerticalCycleSize(int verticalCycleSize)
          Write access method for verticalCycleSize
 void setVirtualRobot(CardFinder robot)
          Set the robot that uses this map.
 void setWhenCheck(int whenCheck)
          Write access method for attribute whenCheck
 void trackPosition()
          Creates the map of the arena.
 Map.ShortestPath unknownFields()
          Checks whether there are still unknown fields in the arena.
private  void updateSurroundingMapItems(MapItem mapItem, int notThisDirection)
          Checks the neighbour MapItems of the specified one.
 boolean wormholeHasBeenUsed()
          Determines using map internal data whether the robot has used a wormhole in the previous round.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

SOUTH

public static final int SOUTH
Defines the 6 direction in the robot's world. The directions in the robot's world need not necessarily match the directions in the real world.

SOUTH_WEST

public static final int SOUTH_WEST
Defines the 6 direction in the robot's world. The directions in the robot's world need not necessarily match the directions in the real world.

NORTH_WEST

public static final int NORTH_WEST
Defines the 6 direction in the robot's world. The directions in the robot's world need not necessarily match the directions in the real world.

NORTH

public static final int NORTH
Defines the 6 direction in the robot's world. The directions in the robot's world need not necessarily match the directions in the real world.

NORTH_EAST

public static final int NORTH_EAST
Defines the 6 direction in the robot's world. The directions in the robot's world need not necessarily match the directions in the real world.

SOUTH_EAST

public static final int SOUTH_EAST
Defines the 6 direction in the robot's world. The directions in the robot's world need not necessarily match the directions in the real world.

areaCounter

private int areaCounter

robot

private CardFinder robot
The robot that uses this map

sawKnownFields

private int sawKnownFields
For keeping statistics how many fields have been sawn more than once, and thus redundantly.

gameRound

private int gameRound
Stores the number of the game round currently in progress.

exitKnown

private boolean exitKnown
Is set to true when robot finds the exit

energyKnown

private boolean energyKnown
Is set to true when robot finds an energy source (recharger)

wormholeKnown

private boolean wormholeKnown
Is set to true when robot finds a wormhole

verticalCycleSize

private int verticalCycleSize
Stores the size of a vertical cycle in the arena. Is -1 if there is no vertical cycle or non has been found, yet.

horizontalCycleSize

private int horizontalCycleSize
Stores the size of a horizontal cycle in the arena. Is -1 if there is no horizontal cycle or non has been found, yet.

itemTreeMap

private java.util.TreeMap itemTreeMap
Datastructure to keep all map items quickly accessible by their id

itemCoordinateTable

private java.util.Hashtable itemCoordinateTable
Datastructure to keep all map items quickly accessible by their coordinate

areasJoined

private boolean areasJoined
Is set to true exactly in the round, in which two different areas could be joined because a position had been found that is common to both areas. Used by the shortest path methods, because the "knowledge" of the robot changes in such a situation

pathError

private int pathError
If any of the methods dealing with shortest paths fails, it sets this value to an error code explaing the reason of the failure.

OKAY

public static final int OKAY
Error code returned by getPathError(). Everything is fine

NOT_FOUND

public static final int NOT_FOUND
Error code returned by getPathError(). A map item with the given specifications could not be found. Only generated if maxDistance is infinite (-1).

MAX_DISTANCE_EXCEEDED

public static final int MAX_DISTANCE_EXCEEDED
Error code returned by getPathError(). A map item with the given specifications could not be found in the given maximum distance.

ROBOT_BLOCKS

public static final int ROBOT_BLOCKS
Error code returned by getPathError(). Another robot blocks the way. See also SLEEPING_ROBOT_BLOCKS.

CARD_BLOCKS

public static final int CARD_BLOCKS
Error code returned by getPathError(). A card blocks the way.

ALREADY_THERE

public static final int ALREADY_THERE
Error code returned by getPathError(). You already reached the requested position.

INVALID

public static final int INVALID
Error code returned by getPathError() This path does not is not valid any more

VIA_RECHARGER

public static final int VIA_RECHARGER
Error code returned by getPathError(). The requested destination is only reachable via an energy source. This code is currently not generated.

UNUSED_WORMHOLES

public static final int UNUSED_WORMHOLES
Error code returned by getPathError(): There are no unknown fields, but unused wormholes

WORMHOLE_WAS_BLOCKED

public static final int WORMHOLE_WAS_BLOCKED
Error code returned by getPathError(): The used wormhole was blocked.

PROGRAM_BUG

public static final int PROGRAM_BUG
Error code returned by getPathError(). The programmer of this code f*cked up.

rand

private java.util.Random rand
Random number generator used by the shortest path methods. Different paths with the same (shortest) length are chosen randomly to bring some life into the actions. ;)

notVisitedNeighbours

int notVisitedNeighbours
saves the number of the neighbours which are not visited

STOP_IN_FRONT_OF_ITEM

static final int STOP_IN_FRONT_OF_ITEM
Flag for findShortestPath() Does not go directly onto field which contains the item, but stops in front of it, when the robot looks at it. Should be used e.g. for Cards

USE_NOT_VISITED

static final int USE_NOT_VISITED
Flag for findShortestPath() Also used fields marked as NOT_VISITED during the search. That may cause that the robot has to recalculate the path when it finds that NOT_VISITED field was a wall or similar

DONT_USE_RECENT_CARDS

static final int DONT_USE_RECENT_CARDS
Flag for findShortestPath() During searching the path do not go over cards the robot has found during the last 10 rounds.

FORCE_EXPLORING

static final int FORCE_EXPLORING
Flag for findShortestPath() Priorize MapItems which have the most NOT_VISITED neighbours.

usedWormhole

private MapItem usedWormhole
usesWormhole() stores here the wormhole to be used.

postWormholeUsageState

private int postWormholeUsageState
For internal use of postWormholeUsage(). Keeps track whether the robot has aready turned to look at the wormhole, etc.

stepsToRecharger

private int stepsToRecharger
The distance to the next recharger estimated by isRechargerGettingFar()

whenCheck

private int whenCheck
This value determines how often the shortest path to the recharger is actually calculated by isRechargerGettingFar() and not estimated. It is calculated when gameRound = 0 mod whenCheck.

ENERGY_TOLERANCE

public static final int ENERGY_TOLERANCE
The robot won't try to go paths that are not within getEnergy() - ENERGY_TOLERANCE
Constructor Detail

Map

public Map()
Creates and initializes a new map object
Method Detail

rotateDirectionLeft

public static int rotateDirectionLeft(int direction)
Rotates a given direction value by 90 degrees to the left.
Parameters:
direction - direction to be rotated
Returns:
direction rotated by 90 degrees to the left

rotateDirectionRight

public static int rotateDirectionRight(int direction)
Rotates a given direction value by 90 degrees to the right.
Parameters:
direction - direction to be rotated
Returns:
direction rotated by 90 degrees to the right

oppositeDirection

public static int oppositeDirection(int direction)
Rotates a given direction value by 180 degrees.
Parameters:
direction - direction to be rotated
Returns:
direction rotated by 180 degrees.

setVirtualRobot

public void setVirtualRobot(CardFinder robot)
Set the robot that uses this map.
Parameters:
robot - the robot that uses this map

getVirtualRobot

public CardFinder getVirtualRobot()
Get the robot that uses this map.
Returns:
the robot that uses this map

getGameRound

public int getGameRound()
Get the number of the game round currently in progress. Round numbers start couting at 1, thus numbers <= 0 are not valid round numbers and can be used for special cases in other contexts.
Returns:
number of current round

isExitKnown

public boolean isExitKnown()
Checks whether the robot has already found the exit during the arena exploration.
Returns:
true if exit has already been found

isEnergyKnown

public boolean isEnergyKnown()
Checks whether the robot has already found an energy source (recharger) during the arena exploration.
Returns:
true if an energy source has already been found

isWormholeKnown

public boolean isWormholeKnown()
Checks whether the robot has already found a wormhole during the arena exploration.
Returns:
true if a wormhole has already been found

getVerticalCycleSize

public int getVerticalCycleSize()
Read access method for verticalCycleSize
Returns:
the value of verticalCycleSize

setVerticalCycleSize

public void setVerticalCycleSize(int verticalCycleSize)
Write access method for verticalCycleSize
Parameters:
verticalCycleSize - the new value

getHorizontalCycleSize

public int getHorizontalCycleSize()
Read access method for horizontalCycleSize
Returns:
the value of horizontalCycleSize

setHorizontalCycleSize

public void setHorizontalCycleSize(int horizontalCycleSize)
Write access method for horizontalCycleSize
Parameters:
horizontalCycleSize - the new value

getCurrentMapItem

public MapItem getCurrentMapItem()
Returns the map item the robot currently sits on.
Returns:
the map item the robot currently sits on.

getMapItemInFront

public MapItem getMapItemInFront()
Returns the map item the robot currently looks at.
Returns:
the map item the robot currently looks at.

getMapItemLeft

public MapItem getMapItemLeft()
Returns the map item to the left of the robot (relative to robot's direction). Note that this map item may not reflect the current state of the item, but the state when this item was actually seen by the robot. Thus, the map item may be marked to contain a card, but the card could have been already taken away by another robot. If this method returns null, this position is not yet known.

getMapItemRight

public MapItem getMapItemRight()
Returns the map item to the right of the robot (relative to robot's direction). Note that this map item may not reflect the current state of the item, but the state when this item was actually seen by the robot. Thus, the map item may be marked to contain a card, but the card could have been already taken away by another robot. If this method returns null, this position is not yet known.

findMapItemById

public MapItem findMapItemById(int id)
Searches all known map items for the map item with the given id
Parameters:
id - the id to search for
Returns:
map item with the specified id or null if id is unknown

findMapItemByCoordinate

public MapItem findMapItemByCoordinate(Map.Coordinate coordinate)
Searches all known map items for the map item with the given coordinate
Parameters:
coordinate - the coordinate to search for
Returns:
map item with the specified coordinate or null if coordinate is unknown

addMapItem

public void addMapItem(MapItem mapItem)
Add a MapItem to the internal lists. Be careful not to modify the id and coordinate values of the MapItem while it is in the internal list. Thus, if you need to modify one of these values, call removeMapItem(), modify the value and then call addMapItem() again. The map item is not added to this Map's graph!
Parameters:
mapItem - The mapItem to be added

removeMapItem

public void removeMapItem(MapItem mapItem)
Removes a given MapItem from the internal lists. The MapItem is not removed from this Map's graph!
Parameters:
mapItem - The mapItem to be removed.

updateSurroundingMapItems

private void updateSurroundingMapItems(MapItem mapItem,
                                       int notThisDirection)
Checks the neighbour MapItems of the specified one. If the neighbour exists, the link between the MapItems is set, otherwise a new neighbour with type NOT_VISITED is created (unless if specified mapItem is of type NOT_VISITED).
Parameters:
mapItem - The MapItem to be surrounded.
notThisDirection - The link in the specified direction will not be changed.

joinMapItemLinks

private void joinMapItemLinks(MapItem mapItem,
                              MapItem mapItemRemove)
Joins two MapItems into one. This is done by taking the links to visited fields from one MapItem and putting these into the corresponding links of the other MapItem. Assumes that if one mapItem has links to a visited field in a direction, the other has no link to a visited field in that direction, because if this would have been the case, the area join operation would have been done before.
Parameters:
mapItem - a MapItem to join. This MapItem will stay (in joined state) in the Map graph
mapItemRemove - the oter MapItem to join. This MapItem will be after the joining removed from the Map graph

joinAreas

private void joinAreas(MapItem mapItemHere,
                       MapItem mapItemNeighbour,
                       int direction)
joinAreas() is called when the trackPosition() Method finds two neigbour fields which belong to different mapping areas. A new mapping area is created when the roboter uses for example a wormhole and has thus no reference map item to link the newly created map to. When a link is found (the neighbour fields) this method joins the two areas to one.
Parameters:
mapItemHere - the MapItem the robot sits on
mapItemInFront - the MapItem the robot looks at, should be in another area than mapItemHere.
direction - int-value of the direction

checkCyclicArena

private void checkCyclicArena(MapItem mapItemHere,
                              MapItem mapItemNeighbour,
                              int direction)
Checks whether the MapItem the robot sits on and the MapItem the robot looks at indicates a cyclic arena. If so, the cycle is also created in the robot's map. Is called in each round by trackPosition().
Parameters:
mapItemHere - the MapItem the robot sits on
mapItemInFront - the MapItem the robot looks at.
direction - int-value of the direction

trackPosition

public void trackPosition()
Creates the map of the arena. Takes care that after the use of wormholes the map is still consistent and the two disjunct parts are joined when enough data is available. Should be called directly at the beginning of getCommand()

printMap

public void printMap()
Debug code: Prints an ASCII version of the map to the terminal

getPathError

public int getPathError()
If any of the methods dealing with shortest paths fails, this method can be used to obtain an error code explaing the reason of the failure. If a method does work successfully, this method should not be called, as it may return any result in this case.

addAdjacentItemsToQueue

private int addAdjacentItemsToQueue(MapItem mapItem,
                                    int predecessorDirection,
                                    MapItemMatcher mapItemMatcher,
                                    java.util.TreeSet queue,
                                    int addedToQueue)
Adds add items linked to the given mapItem to the priority queue of the dijstra algorithm. Takes care that the correct weights are chosen for the links. Called by performDij().
Parameters:
mapItem - the MapItems linked to this MapItem will be added to the queue.
predecessorDirection - the direction the predecessor of the specified MapItem is linked with the specified MapItem. That is, the direction the robot has when it sits on mapItem. This value is used for calculating the weight of the links: The link to the item the robot looks at gets the weight 1 (for one MoveAction), all others get the weight 2 (for one RotateAction and one MoveAction).
mapItemMatcher - the mapItemMatcher used for this search.
queue - the priority queue used by this search. The adjacent items will be added to this queue.
addedToQueue - this value is increased whenever a MapItem has been added to the queue in order to give the queue a total ordering. The new value of addedToQueue will be returned by this method.
Returns:
the new value of addedToQueue

setNotVisitedNeighbours

public void setNotVisitedNeighbours(int value)
Method to set the number of the not-visited neighbours
Parameters:
value - number of the neighbours which have not been visited

countNotVisitedNeighbours

private int countNotVisitedNeighbours(MapItem mapItem)
Method the determine the number of the not visited neighbours
Parameters:
mapItem - a reference to the MapItem whose sourrounding should be discovered
Returns:
number of the not visited neighbours

performDij

private java.util.LinkedList performDij(MapItemMatcher mapItemMatcher,
                                        MapItem startMapItem,
                                        int maxDistance,
                                        int flags)
Searches for the nearest map item that matches with the specified search criteria. This is done with the Dijkstra algorithm on the map item graph. Edges on which the robot has not to change its direction, are weighted 1 and edges on which the robot has to rotate, are weighted with 2. Thus, this function finds the shortest way in terms of actions, is however somewhat slower than the breadth first search. The given startMapItem is included as the first map item in this list. If the specified MapItemMatcher searched for more than one map item, this is the path to the map item for which mapItemMatcher.finish() returned true. To get the other paths you have to use MapItem.getBfsPredecessor().
Parameters:
mapItemMatcher - instance of an implementation of a MapItemMatcher.Used to determine what map items are actually wanted.
startMapItem - the map item the search starts at
maxDistance - if the search exceeds this distance without being successful, the search will be stopped
Returns:
LinkedList of MapItems representing the shortest way to the item that has been searched for.

findShortestPath

public Map.ShortestPath findShortestPath(MapItemMatcher mapItemMatcher,
                                         int maxDistance,
                                         int flags)
Tries to find a shortest path that is at most maxDistance steps long to a map item that can be specified using the mapItemMatcher.
Parameters:
mapItemMatcher - instance of an implementation of a MapItemMatcher. Used to determine what map items are actually wanted.
maxDistance - paths that are returned by this method will not exceed this distance.
Returns:
A ShortestPath to the requested map item, or null if there was an error. Use getPathError() to find out what error.

unknownFields

public Map.ShortestPath unknownFields()
Checks whether there are still unknown fields in the arena. The result is returned as a ShortestPath to something. To find out, to what the ShortestPath leads, use getPathError(). These are the possible results:

preWormholeUsage

public boolean preWormholeUsage()
This method tells the map that the robot is about to use a wormhole. It must be called when the strategies want to use a wormhole manually, i.e. not by using the AbractActions generated by nextStep() (nextStep() calls this method already internally).

postWormholeUsage

public AbstractRobotAction postWormholeUsage()
This method tells the map that the robot has just passed a wormhole. It must be called when the strategies want to use a wormhole manually, i.e. not by using the AbractActions generated by nextStep() (nextStep() calls this method already internally). It may return an AbstractRobotAction != null. If so, the robot should pass this action to the getCommand() method and call in the next gameRound postWormholeUsage() again until it returns null.
Returns:
AbstractRobotAction action needed for orientation of the robot.

wormholeHasBeenUsed

public boolean wormholeHasBeenUsed()
Determines using map internal data whether the robot has used a wormhole in the previous round. This method should only be used to calculate path weights and not for determining actions. This is done by postWormholeUsage()
Returns:
true if the robot walked through a wormhole in the previous round

setWhenCheck

public void setWhenCheck(int whenCheck)
Write access method for attribute whenCheck
Parameters:
whenCheck - the new value for whenCheck

isRechargerGettingFar

public boolean isRechargerGettingFar()
isRechargerGettingFar() tells the robot in a fast way, whether the next recharger is dangerously too far away. Must be called in each round of game!
Returns:
true, when VirtualRobot should start EnergyStrategy(), or false, when either no recharger was found yet or everything is OK.