## edu.cwru.SimpleRTS.agent
Class Agent

    java.lang.Object
      edu.cwru.SimpleRTS.agent.Agent

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  CombatAgent, MyAgent, ScriptedGoalAgent, SimpleAgent1, SimpleAgent2, VisualAgent

    public abstract class Agent

extends java.lang.Object
implements java.io.Serializable

The base type for any agent that can interact with the SimpleRTS environment.

Author:
  Tim
See Also:
  Serialized Form

Method Summary
`void` `acceptInitialState(State.StateView newstate, java.util.concurrent.CountDownLatch onofflatch)` Accept the first state of an episode and begin calculating a response for it
`void` `acceptMiddleState(State.StateView newstate, java.util.concurrent.CountDownLatch onofflatch)` Accept a state and begin calculating a response for it
`void` `acceptTerminalState(State.StateView newstate, java.util.concurrent.CountDownLatch onofflatch)` Accept the final state of an episode
`boolean` `equals(java.lang.Object o)`
`com.google.common.collect.ImmutableMap<java.lang.Integer,Action>` `getAction()` Request the action that the agent will take at this timestep.
`static boolean` `getCountsTowardTermination(int id)`
`int` `getPlayerNumber()` Get the player number that this agent controls
`static java.lang.String` `getUsage()` Return the usage of any additional parameters
`int` `hashCode()`
`abstract com.google.common.collect.ImmutableMap.Builder<java.lang.Integer,Action>` `initialStep(State.StateView newstate)` Accept the initial state of an episode
`static int` `maxId()` The highest ID number that has been assigned to an agent
`abstract com.google.common.collect.ImmutableMap.Builder<java.lang.Integer,Action>` `middleStep(State.StateView newstate)` Accept an intermediate state of an episode
`static void` `reserveIDsUpTo(int minID)` Doesn't really need to be called usually, as you construct agents when you run the main method, and they are not part of the state
`void` `setVerbose(boolean verbosity)` Determines whether to print out the action list each time it is chosen by `getAction()`
`abstract void` `terminalStep(State.StateView newstate)` Receive notification that the episode has terminated.

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### reserveIDsUpTo

    public static void reserveIDsUpTo(int minID)

  Doesn't really need to be called usually, as you construct agents when you run the main method, and they are not part of the state

  Parameters:
    `minID` -

### maxId

    public static int maxId()

  The highest ID number that has been assigned to an agent

  Returns:

### getCountsTowardTermination

    public static boolean getCountsTowardTermination(int id)

### getUsage

    public static java.lang.String getUsage()

  Return the usage of any additional parameters

  Returns:

### setVerbose

    public void setVerbose(boolean verbosity)

  Determines whether to print out the action list each time it is chosen by `getAction()`

  Parameters:
    `verbosity` -

### getPlayerNumber

    public int getPlayerNumber()

  Get the player number that this agent controls

  Returns:

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### getAction

    public final com.google.common.collect.ImmutableMap<java.lang.Integer,Action> getAction()

  Request the action that the agent will take at this timestep. The agent should have been asynchronously calculating this. Must not be called until calculation is done. You will know that it is done by the latch being passed to acceptState()

  Returns:

### acceptInitialState

    public final void acceptInitialState(State.StateView newstate,
                                         java.util.concurrent.CountDownLatch onofflatch)

  Accept the first state of an episode and begin calculating a response for it

  Parameters:
    `newstate` - The new state of the system
    `onofflatch` - A countdown latch used to synchonize completion

### acceptMiddleState

    public final void acceptMiddleState(State.StateView newstate,
                                        java.util.concurrent.CountDownLatch onofflatch)

  Accept a state and begin calculating a response for it

  Parameters:
    `newstate` - The new state of the system
    `onofflatch` - A countdown latch used to synchonize completion

### acceptTerminalState

    public final void acceptTerminalState(State.StateView newstate,
                                          java.util.concurrent.CountDownLatch onofflatch)

  Accept the final state of an episode

  Parameters:
    `newstate` - The new state of the system
    `onofflatch` - A countdown latch used to synchonize completion

### initialStep

    public abstract com.google.common.collect.ImmutableMap.Builder<java.lang.Integer,Action> initialStep(State.StateView newstate)

  Accept the initial state of an episode

  Parameters:
    `newstate` - The new state of the system
    `onofflatch` - A countdown latch used to synchonize completion

### middleStep

    public abstract com.google.common.collect.ImmutableMap.Builder<java.lang.Integer,Action> middleStep(State.StateView newstate)

  Accept an intermediate state of an episode

  Parameters:
    `newstate` - The new state of the system
    `onofflatch` - A countdown latch used to synchonize completion

### terminalStep

    public abstract void terminalStep(State.StateView newstate)

  Receive notification that the episode has terminated.

  Parameters:
    `newstate` - The final state of the system