examples
Class testMovingAgent2

java.lang.Object
  extended bysema.Element
      extended bysema.Agent
          extended bymodelling.MovingAgent
              extended byexamples.testMovingAgent2
All Implemented Interfaces:
java.lang.Comparable

public class testMovingAgent2
extends MovingAgent

This test the moving agent capacity of random moving, with a system of check point : it moves until it goes in a defined area. when reach these area it gain a certain number of paces allowed to do. they are happy when they have some more pace or have reached their final area. (the areas are the verticals rectangle centered in 2*checkpointnumber +- 1. We can see these that agent randomly moving don't succed to go at the right most.


Nested Class Summary
 
Nested classes inherited from class modelling.MovingAgent
MovingAgent.Errer, MovingAgent.MoveTo
 
Nested classes inherited from class sema.Agent
Agent.Action
 
Nested classes inherited from class sema.Element
Element.ElementEvent
 
Field Summary
 
Fields inherited from class sema.Element
id, world
 
Constructor Summary
testMovingAgent2(World world, float delay, java.awt.Image image, float speed)
          Creates a new instance of testMovingAgent
 
Method Summary
protected  boolean acceptAction(Agent.Action a)
          Global internal heuristic method of decision as to the actions to undertake.
 void draw()
          Draws the element.
 java.lang.String[][] getProperties()
          Returns the element's properties.
 
Methods inherited from class modelling.MovingAgent
canSee, fitStep, getSpeed, randomStep, rotate, setSpeed, translate, walk
 
Methods inherited from class sema.Agent
getDelay, registerAction, setDelay, unregisterAction
 
Methods inherited from class sema.Element
canTake, compareTo, death, getArea, getDrawingPriority, getHeight, getIcon, getImage, getKind, getName, highlight, highlight, isMarked, kill, setDrawingPriority, setHeight, setKind, setMarked, setProperties, toString, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

testMovingAgent2

public testMovingAgent2(World world,
                        float delay,
                        java.awt.Image image,
                        float speed)
Creates a new instance of testMovingAgent

Method Detail

draw

public void draw()
Description copied from class: Element
Draws the element.

Overrides:
draw in class Element
See Also:
Drawing

acceptAction

protected boolean acceptAction(Agent.Action a)
Description copied from class: Agent
Global internal heuristic method of decision as to the actions to undertake. It is called before each call to an action to determinate whether it should be executed. If it returns 'false', the Agent.Action.whenRefused() method is called and the action who called acceptAction is killed. This method has an overwhelming power of decision on the action, which cannot ignore this decision. The default acceptAction method always returns true. It's designed to provide an easy-to-use main decision function to manage actions.

Overrides:
acceptAction in class MovingAgent

getProperties

public java.lang.String[][] getProperties()
Description copied from class: Element
Returns the element's properties.

Overrides:
getProperties in class Element
Returns:
the element's properties.
See Also:
Engine.getProperties()