ctf.common
Interface AgentEnvironment

All Known Implementing Classes:
EnvironmentSnapshot

public interface AgentEnvironment

Interface that can be passed to an agent to let it know what's going on in the environment. This is an agent's only window into the state of the environment, and the information provided is agent-centric (in other words, the point of reference is the agent's current location).

All methods return booleans that describe whether the particular environment property is true.

During the game, an AgentEnvironment object will be passed in to your agent through your agent's getMove method. You can inspect the environment using the methods provided by the AgentEnvironment.

Author:
Jason Rohrer

Field Summary
static int ENEMY_TEAM
          Enemy team identifier constant.
static int OUR_TEAM
          Our team identifier constant.
 
Method Summary
 boolean hasFlag()
          Returns true iff this agent has the enemy flag.
 boolean hasFlag(int inTeam)
          Returns true iff an agent on the specified team has the other team's flag.
 boolean isAgentEast(int inTeam, boolean inImmediate)
          Returns true iff an agent from the specified team is somewhere to the east of this agent (to right of agent's current horizontal position).
 boolean isAgentNorth(int inTeam, boolean inImmediate)
          Returns true iff an agent from the specified team is somewhere to the north of this agent (above agent's current vertical position).
 boolean isAgentSouth(int inTeam, boolean inImmediate)
          Returns true iff an agent from the specified team is somewhere to the south of this agent (below agent's current vertical position).
 boolean isAgentWest(int inTeam, boolean inImmediate)
          Returns true iff an agent from the specified team is somewhere to the west of this agent (to left of agent's current horizontal position).
 boolean isBaseEast(int inTeam, boolean inImmediate)
          Returns true iff the specified team's base is somewhere to the east of this agent (above agent's current vertical position).
 boolean isBaseNorth(int inTeam, boolean inImmediate)
          Returns true iff the specified team's base is somewhere to the north of this agent (above agent's current vertical position).
 boolean isBaseSouth(int inTeam, boolean inImmediate)
          Returns true iff the specified team's base is somewhere to the south of this agent (above agent's current vertical position).
 boolean isBaseWest(int inTeam, boolean inImmediate)
          Returns true iff the specified team's base is somewhere to the west of this agent (above agent's current vertical position).
 boolean isFlagEast(int inTeam, boolean inImmediate)
          Returns true iff the specified team's flag is somewhere to the east of this agent (to right of agent's current horizontal position).
 boolean isFlagNorth(int inTeam, boolean inImmediate)
          Returns true iff the specified team's flag is somewhere to the north of this agent (above agent's current vertical position).
 boolean isFlagSouth(int inTeam, boolean inImmediate)
          Returns true iff the specified team's flag is somewhere to the south of this agent (below agent's current vertical position).
 boolean isFlagWest(int inTeam, boolean inImmediate)
          Returns true iff the specified team's flag is somewhere to the west of this agent (to left of agent's current horizontal position).
 boolean isObstacleEastImmediate()
          Returns true an obstacle is in the space immediately east of this agent.
 boolean isObstacleNorthImmediate()
          Returns true an obstacle is in the space immediately north of this agent.
 boolean isObstacleSouthImmediate()
          Returns true an obstacle is in the space immediately south of this agent.
 boolean isObstacleWestImmediate()
          Returns true an obstacle is in the space immediately north of this agent.
 

Field Detail

OUR_TEAM

public static final int OUR_TEAM
Our team identifier constant.

ENEMY_TEAM

public static final int ENEMY_TEAM
Enemy team identifier constant.
Method Detail

isFlagNorth

public boolean isFlagNorth(int inTeam,
                           boolean inImmediate)
Returns true iff the specified team's flag is somewhere to the north of this agent (above agent's current vertical position).
Parameters:
inTeam - check for flag of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the north of this agent (and thus spaces further away are ignored).

isFlagSouth

public boolean isFlagSouth(int inTeam,
                           boolean inImmediate)
Returns true iff the specified team's flag is somewhere to the south of this agent (below agent's current vertical position).
Parameters:
inTeam - check for flag of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the south of this agent (and thus spaces further away are ignored).

isFlagEast

public boolean isFlagEast(int inTeam,
                          boolean inImmediate)
Returns true iff the specified team's flag is somewhere to the east of this agent (to right of agent's current horizontal position).
Parameters:
inTeam - check for flag of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the east of this agent (and thus spaces further away are ignored).

isFlagWest

public boolean isFlagWest(int inTeam,
                          boolean inImmediate)
Returns true iff the specified team's flag is somewhere to the west of this agent (to left of agent's current horizontal position).
Parameters:
inTeam - check for flag of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the west of this agent (and thus spaces further away are ignored).

isBaseNorth

public boolean isBaseNorth(int inTeam,
                           boolean inImmediate)
Returns true iff the specified team's base is somewhere to the north of this agent (above agent's current vertical position).
Parameters:
inTeam - check for base of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the north of this agent (and thus spaces further away are ignored).

isBaseSouth

public boolean isBaseSouth(int inTeam,
                           boolean inImmediate)
Returns true iff the specified team's base is somewhere to the south of this agent (above agent's current vertical position).
Parameters:
inTeam - check for base of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the south of this agent (and thus spaces further away are ignored).

isBaseEast

public boolean isBaseEast(int inTeam,
                          boolean inImmediate)
Returns true iff the specified team's base is somewhere to the east of this agent (above agent's current vertical position).
Parameters:
inTeam - check for base of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the east of this agent (and thus spaces further away are ignored).

isBaseWest

public boolean isBaseWest(int inTeam,
                          boolean inImmediate)
Returns true iff the specified team's base is somewhere to the west of this agent (above agent's current vertical position).
Parameters:
inTeam - check for base of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the west of this agent (and thus spaces further away are ignored).

isAgentNorth

public boolean isAgentNorth(int inTeam,
                            boolean inImmediate)
Returns true iff an agent from the specified team is somewhere to the north of this agent (above agent's current vertical position).
Parameters:
inTeam - check for agent of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the north of this agent (and thus spaces further away are ignored).

isAgentSouth

public boolean isAgentSouth(int inTeam,
                            boolean inImmediate)
Returns true iff an agent from the specified team is somewhere to the south of this agent (below agent's current vertical position).
Parameters:
inTeam - check for agent of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the south of this agent (and thus spaces further away are ignored).

isAgentEast

public boolean isAgentEast(int inTeam,
                           boolean inImmediate)
Returns true iff an agent from the specified team is somewhere to the east of this agent (to right of agent's current horizontal position).
Parameters:
inTeam - check for agent of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the east of this agent (and thus spaces further away are ignored).

isAgentWest

public boolean isAgentWest(int inTeam,
                           boolean inImmediate)
Returns true iff an agent from the specified team is somewhere to the west of this agent (to left of agent's current horizontal position).
Parameters:
inTeam - check for agent of this team, valid values in [OUR_TEAM, ENEMY_TEAM].
inImmediate - set to true if trying to check only space immediately to the west of this agent (and thus spaces further away are ignored).

hasFlag

public boolean hasFlag()
Returns true iff this agent has the enemy flag.

hasFlag

public boolean hasFlag(int inTeam)
Returns true iff an agent on the specified team has the other team's flag.
Parameters:
inTeam - check if this team has the other team's flag, valid values in [OUR_TEAM, ENEMY_TEAM].

isObstacleNorthImmediate

public boolean isObstacleNorthImmediate()
Returns true an obstacle is in the space immediately north of this agent.

isObstacleSouthImmediate

public boolean isObstacleSouthImmediate()
Returns true an obstacle is in the space immediately south of this agent.

isObstacleEastImmediate

public boolean isObstacleEastImmediate()
Returns true an obstacle is in the space immediately east of this agent.

isObstacleWestImmediate

public boolean isObstacleWestImmediate()
Returns true an obstacle is in the space immediately north of this agent.