ctf.environment
Class EnvironmentSnapshot

java.lang.Object
  |
  +--ctf.environment.EnvironmentSnapshot

class EnvironmentSnapshot
extends Object
implements AgentEnvironment

Snapshot of the environment state.

Author:
Jason Rohrer

Fields inherited from interface ctf.common.AgentEnvironment
ENEMY_TEAM, OUR_TEAM
 
Constructor Summary
(package private) EnvironmentSnapshot(ObstacleGrid inObstacleGrid, AgentGrid inOurTeamGrid, AgentGrid inEnemyTeamGrid, BaseGrid inOurBaseGrid, BaseGrid inEnemyBaseGrid, FlagGrid inOurFlagGrid, FlagGrid inEnemyFlagGrid, AgentInfo inCentralAgentInfo, int inBoardSize)
          Constructs an EnvironmentSnapshot.
 
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.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentSnapshot

EnvironmentSnapshot(ObstacleGrid inObstacleGrid,
                    AgentGrid inOurTeamGrid,
                    AgentGrid inEnemyTeamGrid,
                    BaseGrid inOurBaseGrid,
                    BaseGrid inEnemyBaseGrid,
                    FlagGrid inOurFlagGrid,
                    FlagGrid inEnemyFlagGrid,
                    AgentInfo inCentralAgentInfo,
                    int inBoardSize)
Constructs an EnvironmentSnapshot.
Parameters:
inObstacleGrid - grid of obstacles.
inOurTeamGrid - grid of agent positions for our team.
inEnemyTeamGrid - grid of enemy agent positions.
inOurFlagGrid - grid of our flag position.
inEnemyFlagGrid - grid of enemy flag position.
inCentralAgentInfo - info about agent that this snapshot's AgentEnvironment methods should deal with.
Method Detail

isFlagNorth

public boolean isFlagNorth(int inTeam,
                           boolean inImmediate)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's flag is somewhere to the north of this agent (above agent's current vertical position).
Specified by:
isFlagNorth in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's flag is somewhere to the south of this agent (below agent's current vertical position).
Specified by:
isFlagSouth in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's flag is somewhere to the east of this agent (to right of agent's current horizontal position).
Specified by:
isFlagEast in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's flag is somewhere to the west of this agent (to left of agent's current horizontal position).
Specified by:
isFlagWest in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's base is somewhere to the north of this agent (above agent's current vertical position).
Specified by:
isBaseNorth in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's base is somewhere to the south of this agent (above agent's current vertical position).
Specified by:
isBaseSouth in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's base is somewhere to the east of this agent (above agent's current vertical position).
Specified by:
isBaseEast in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff the specified team's base is somewhere to the west of this agent (above agent's current vertical position).
Specified by:
isBaseWest in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff an agent from the specified team is somewhere to the north of this agent (above agent's current vertical position).
Specified by:
isAgentNorth in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
Returns true iff an agent from the specified team is somewhere to the south of this agent (below agent's current vertical position).
Specified by:
isAgentSouth in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
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).
Specified by:
isAgentEast in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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)
Description copied from interface: AgentEnvironment
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).
Specified by:
isAgentWest in interface AgentEnvironment
Tags copied from interface: AgentEnvironment
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()
Description copied from interface: AgentEnvironment
Returns true iff this agent has the enemy flag.
Specified by:
hasFlag in interface AgentEnvironment

hasFlag

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

isObstacleNorthImmediate

public boolean isObstacleNorthImmediate()
Description copied from interface: AgentEnvironment
Returns true an obstacle is in the space immediately north of this agent.
Specified by:
isObstacleNorthImmediate in interface AgentEnvironment

isObstacleSouthImmediate

public boolean isObstacleSouthImmediate()
Description copied from interface: AgentEnvironment
Returns true an obstacle is in the space immediately south of this agent.
Specified by:
isObstacleSouthImmediate in interface AgentEnvironment

isObstacleEastImmediate

public boolean isObstacleEastImmediate()
Description copied from interface: AgentEnvironment
Returns true an obstacle is in the space immediately east of this agent.
Specified by:
isObstacleEastImmediate in interface AgentEnvironment

isObstacleWestImmediate

public boolean isObstacleWestImmediate()
Description copied from interface: AgentEnvironment
Returns true an obstacle is in the space immediately north of this agent.
Specified by:
isObstacleWestImmediate in interface AgentEnvironment