- Direct Known Subclasses:
- BadAgent, BomberAgent, Jcr13Agent, RandomAgent, SecretAgent
- public abstract class Agent
- extends Object
Abstract interface class that must be implemented by an agent.
Forces agents to implement a function
that maps environment state to an action.
Your agent class MUST subclass the
Jcr13Agent for an example of how to do this.
The icon that is drawn to represent an agent is created in
drawIcon. If you want to create a custom icon for your agent,
drawIcon method. Since making a custom icon
isn't necessary, we don't provide an example agent that does this.
Feel free to implement other internal methods in your
subclass that aren't defined in this interface. You're also free to define
any needed inner classes, as well as any internal data structures.
is that all of your code must be in a single java file called
"NetIDAgent.java", where NetID is the net-id of one of the human members
of your team. Thus, if you want to use more than one class (for example,
to implement data structures), you must make inner classes. This is
due to the Java restriction that each non-inner class must be defined in
its own .java file.
All agents must also implement a parameterless constructor! (An easy way
to meet this requirement is to write no constructor at all.)
- Jason Rohrer
Draws the icon representation for this agent.
Gets the agent's next move.
Sets the team color of this agent.
|Methods inherited from class java.lang.Object
protected Color mFillColor
protected Color mLineColor
public abstract int getMove(AgentEnvironment inEnvironment)
- Gets the agent's next move. Implement this method in a class that
inEnvironment - the current agent-centric environment state.
- an action constant. Valid values are defined in
public void drawIcon(Graphics inGraphics,
- Draws the icon representation for this agent. Override this method
in your class that extends
Agent if you want to draw
a custom agent icon.
inGraphics - graphics context to draw agent icon in. Icon should
be drawn in graphics in region defined by (0,0) and
inTeamColor - color associated with this team (can be ignored
if color-independent icon alone is distinguishing enough).
inWide - width of agent icon to be drawn.
inHigh - height of agent icon to be drawn.
public final void setColor(Color inLineColor,
- Sets the team color of this agent.
inLineColor - line color for drawing agent.
inFillColor - fill color for drawing agent.