yaes.application.eel6938.classagents
Class FeedAgent
java.lang.Object
yaes.application.eel6938.game.objects.GameObject
yaes.application.eel6938.game.objects.Agent
yaes.application.eel6938.classagents.FeedAgent
- public class FeedAgent
- extends Agent
- Author:
- Lotzi Boloni
This agent, in its current settings is able to beat the other sample ones.
Its problem is that it can get stuck if an obstacle blocks its way to the food...
Method Summary |
boolean |
eatNeighboringPoint(java.awt.Point p)
|
java.awt.Point |
getClosestPoint(java.awt.Point[] p)
|
int[] |
getColor()
Returns the color of the agent. |
java.lang.String |
getName()
Returns the name of the agent. |
void |
intelligence()
Specifies the user defined agent intelligence, must be implemented by all agents. |
boolean |
moveTowards(java.awt.Point p,
int speed)
|
Methods inherited from class yaes.application.eel6938.game.objects.Agent |
attack, attack, canAttack, canEat, canFlee, canMate, eat, eat, flee, getClosestOpenNeighbouringPoint, getDirections, getEnergyLevel, getSensorAgentList, getSensorDataMap, getSensorFoodList, getSensorObstacleList, mate, move, wasLastCommandSuccessful |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FeedAgent
public FeedAgent()
intelligence
public void intelligence()
- Description copied from class:
Agent
- Specifies the user defined agent intelligence, must be implemented by all agents.
This function is called in a round-robin manner in the game. Available actions are shown in the
list below:
eat
eat(int)
attack()
attack(int)
flee(int)
mate()
move(int, int)
- Specified by:
intelligence
in class Agent
getClosestPoint
public java.awt.Point getClosestPoint(java.awt.Point[] p)
eatNeighboringPoint
public boolean eatNeighboringPoint(java.awt.Point p)
moveTowards
public boolean moveTowards(java.awt.Point p,
int speed)
getName
public java.lang.String getName()
- Description copied from class:
Agent
- Returns the name of the agent.
Must be implemented by all agents in the game.
- Specified by:
getName
in class Agent
- Returns:
- A string describing the name of the agent.
getColor
public int[] getColor()
- Description copied from class:
Agent
- Returns the color of the agent.
Must be implemented by all agents in the game.
- Specified by:
getColor
in class Agent
- Returns:
- An array of three integers descibing the color of the agent. For instance the color red
is specified by the array {255,0,0}. The default color is black.