warbot.kernel
Class BasicBody

java.lang.Object
  extended by SEdit.SElement
      extended by SEdit.SNode
          extended by warbot.kernel.Entity
              extended by warbot.kernel.MovableEntity
                  extended by warbot.kernel.BasicBody
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Explorer, Home, RocketLauncher

public abstract class BasicBody
extends MovableEntity

The abstract body class. All brain are linked to a subclass of it

Version:
0.1
Author:
Fabien Michel
See Also:
Serialized Form

Field Summary
static java.lang.String[] ACTIONS
           
static int BAG_CAPACITY
           
protected  java.lang.String behaviorFileName
           
protected  java.lang.String brainClass
           
static int DISTANCE_TO_EAT
           
static int DISTANCE_TO_TAKE
           
protected static int DROP
           
protected static int DROPALL
           
protected static int EAT
           
protected  int maximumEnergy
           
protected static int TAKE
           
 
Fields inherited from class warbot.kernel.MovableEntity
MOVE
 
Fields inherited from class warbot.kernel.Entity
action, actionIn, detectingRange, displaySize, energy, initialEnergy, NULL, radius, showDetect, showEnergyLevel, speed, x, xdisplay, y, ydisplay
 
Fields inherited from class SEdit.SElement
comment, descriptor, element, id, label, persistent, structure
 
Method Summary
 void buildRocket()
          try to do the action of building a rocket for future launch
 void createAgent(java.lang.String type)
           
 void createDefaultImage()
           
 void delete()
           
 void die()
          suicide
 void drop(int index)
          try to put something out of the robot's bag. you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt
 void dropAll()
          try to put everything out of the robot's bag. you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt
 void eat(Food f)
           
 void edit()
           
 int getBagCapacity()
          return the capacity of the robot's bag.
 java.lang.String getBehaviorFileName()
          Return the behavior file name attached to the brain class used for scripting.
 java.lang.String getBrainClass()
          Get the brain class name of an entity which generally derives from AbstractAgent.
 double getCoveredDistance()
          returns the distance covered during the last time unit.
 int getEnergy()
          return the current energy of the robot
 double getHeading()
          get the robot's current heading
 int getMaximumEnergy()
           
 Percept[] getPercepts()
          return all the percepts avaible within the detecetion range. you have to use the getPerceptType method of an object Percept to know the kind (class) of one percept
 int getRadius()
           
 int getResourceLevel()
           
 int getRocketNb()
           
 boolean getShot()
           
 java.lang.String getTeam()
          return the current team as a String Object
 java.lang.String getUserMessage()
           
protected  void increaseEnergyLevel(int v)
           
 void init()
          Initialization method called at the end of the creation of an element.
 Percept[] inMyBag()
           
 boolean isMyBagEmpty()
          return true if the robot's bag if empty.
 boolean isMyBagFull()
          return true if the robot's bag if full.
 boolean isShowMessages()
           
 boolean isShowUserMessage()
           
 void launchRocket(double direction)
          try to do the action of launching a rocket in the direction wanted to do this kind of action you have to be rocket launcher, this is done by play the role of rocket launcher.
 void makeBrain(java.lang.String className, java.lang.String name, boolean gui, java.lang.String behaviorFileName)
          Creates the brain and launches if it is an agent.
 Percept makePercept(double dx, double dy, double d)
           
 void move()
          try to do the action of move in the world you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt
 boolean moving()
           
 int nbOfObjectsInMyBag()
          return the current nb of objects in the robot's bag.
 void setBehaviorFileName(java.lang.String s)
          Set the behavior file name attached to the brain class used for scripting the behavior.
 void setBrainClass(java.lang.String s)
          set the brain class name of an entity.
 void setHeading(double direction)
          set the robot heading to the direction of value
protected  void setPercepts(Percept[] plst)
           
 void setShowMessages(boolean b)
           
 void setShowUserMessage(boolean b)
           
 void setUserMessage(java.lang.String s)
           
 void take(Transportable p)
          try to put something in the robot's bag. you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt
 void toggleShowMessages()
           
 void toggleShowUserMessage()
           
protected  void tryEat()
           
 
Methods inherited from class warbot.kernel.MovableEntity
getCoveredDistance, getHeading, moving, setHeading, tryMove
 
Methods inherited from class warbot.kernel.Entity
addInArrow, addOutArrow, decreaseEnergyLevel, distanceFrom, dropEntity, getDetectingRange, getEnergy, getEnvironmentAgent, getInArrows, getName, getOutArrows, getRadius, getShot, getShowDetect, getShowEnergyLevel, getSpeed, getTeam, getX, getY, isConnectable, setDetectingRange, setEnergy, setEnvironmentAgent, setName, setRadius, setShowDetect, setShowEnergyLevel, setSpeed, setTeam, setX, setY, toggleShowDetect, toggleShowEnergyLevel, toString
 
Methods inherited from class SEdit.SNode
activate, deleteInArrow, deleteOutArrow, initGraphics, reInstall
 
Methods inherited from class SEdit.SElement
dump, getComment, getDescriptor, getGObject, getID, getLabel, getStructure, inspect, setComment, setDescriptor, setGObject, setID, setLabel, setStructure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISTANCE_TO_TAKE

public static final int DISTANCE_TO_TAKE
See Also:
Constant Field Values

DISTANCE_TO_EAT

public static final int DISTANCE_TO_EAT
See Also:
Constant Field Values

maximumEnergy

protected int maximumEnergy

EAT

protected static final int EAT
See Also:
Constant Field Values

TAKE

protected static final int TAKE
See Also:
Constant Field Values

DROP

protected static final int DROP
See Also:
Constant Field Values

DROPALL

protected static final int DROPALL
See Also:
Constant Field Values

ACTIONS

public static final java.lang.String[] ACTIONS

BAG_CAPACITY

public static final int BAG_CAPACITY
See Also:
Constant Field Values

brainClass

protected java.lang.String brainClass

behaviorFileName

protected java.lang.String behaviorFileName
Method Detail

makePercept

public Percept makePercept(double dx,
                           double dy,
                           double d)
Overrides:
makePercept in class Entity

createDefaultImage

public void createDefaultImage()

setShowMessages

public void setShowMessages(boolean b)

isShowMessages

public boolean isShowMessages()

toggleShowMessages

public void toggleShowMessages()

setBrainClass

public void setBrainClass(java.lang.String s)
set the brain class name of an entity. The brain generally derives from AbstractAgent.


getBrainClass

public java.lang.String getBrainClass()
Get the brain class name of an entity which generally derives from AbstractAgent.


setBehaviorFileName

public void setBehaviorFileName(java.lang.String s)
Set the behavior file name attached to the brain class used for scripting the behavior.


getBehaviorFileName

public java.lang.String getBehaviorFileName()
Return the behavior file name attached to the brain class used for scripting.


makeBrain

public void makeBrain(java.lang.String className,
                      java.lang.String name,
                      boolean gui,
                      java.lang.String behaviorFileName)
Creates the brain and launches if it is an agent. The brain class is given as a String. The name argument is used to instantiate the name of the corresponding agent. If the gui flag is true, a bean is created and associated to this agent.


init

public void init()
Description copied from class: SElement
Initialization method called at the end of the creation of an element. By default do nothing

Overrides:
init in class Entity

setShowUserMessage

public void setShowUserMessage(boolean b)

isShowUserMessage

public boolean isShowUserMessage()

toggleShowUserMessage

public void toggleShowUserMessage()

setUserMessage

public void setUserMessage(java.lang.String s)

getUserMessage

public java.lang.String getUserMessage()

delete

public final void delete()
Overrides:
delete in class Entity

edit

public void edit()

die

public final void die()
suicide


setPercepts

protected void setPercepts(Percept[] plst)

getPercepts

public Percept[] getPercepts()
return all the percepts avaible within the detecetion range. you have to use the getPerceptType method of an object Percept to know the kind (class) of one percept


move

public void move()
try to do the action of move in the world you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt


eat

public void eat(Food f)

getMaximumEnergy

public int getMaximumEnergy()

getResourceLevel

public int getResourceLevel()

tryEat

protected void tryEat()

increaseEnergyLevel

protected void increaseEnergyLevel(int v)
Overrides:
increaseEnergyLevel in class Entity

take

public void take(Transportable p)
try to put something in the robot's bag. you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt


inMyBag

public Percept[] inMyBag()

isMyBagEmpty

public boolean isMyBagEmpty()
return true if the robot's bag if empty.


isMyBagFull

public boolean isMyBagFull()
return true if the robot's bag if full.


getBagCapacity

public int getBagCapacity()
return the capacity of the robot's bag.


nbOfObjectsInMyBag

public int nbOfObjectsInMyBag()
return the current nb of objects in the robot's bag.


drop

public void drop(int index)
try to put something out of the robot's bag. you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt


dropAll

public void dropAll()
try to put everything out of the robot's bag. you can do this action only one time per turn (when the robot is actived), so it is useless to call it several time in the doIt


launchRocket

public void launchRocket(double direction)
try to do the action of launching a rocket in the direction wanted to do this kind of action you have to be rocket launcher, this is done by play the role of rocket launcher. As the action move, it is useless to call this method several time in the doIt: at most just one rocket will be launched


buildRocket

public void buildRocket()
try to do the action of building a rocket for future launch


getRocketNb

public int getRocketNb()

createAgent

public void createAgent(java.lang.String type)

setHeading

public void setHeading(double direction)
set the robot heading to the direction of value


getHeading

public double getHeading()
get the robot's current heading


getTeam

public java.lang.String getTeam()
return the current team as a String Object


getCoveredDistance

public double getCoveredDistance()
returns the distance covered during the last time unit. This method may be called to sum the path taken by agents.


getEnergy

public int getEnergy()
return the current energy of the robot


getShot

public boolean getShot()

moving

public boolean moving()

getRadius

public int getRadius()


Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.