cz.cuni.sposhBot.java.examples
Class MyBehaviour

java.lang.Object
  extended by cz.cuni.sposhBot.java.JavaBehaviour
      extended by cz.cuni.sposhBot.java.examples.MyBehaviour

public class MyBehaviour
extends JavaBehaviour

Here is the place to implement your acts and senses The log domain of a behaviour is set to class name. act: in plan file: shoot in behaviour: public void action_shoot() sense: in plan file: hear in behaviour: public boolean sense_hear() E.g. see action_doNothing() / sense_fail()


Field Summary
protected  Item choosenItem
           
 java.util.ArrayList<Item> itemsToRunAround
           
protected  boolean jumped
           
 java.util.ArrayList<Item> medkitsToRunAround
           
protected  boolean medsRestart
           
protected  Item previousChoosenItem
           
 
Fields inherited from class cz.cuni.sposhBot.java.JavaBehaviour
bot, log
 
Constructor Summary
MyBehaviour(java.lang.String name, java.util.logging.Logger log, SPoshBot bot)
           
 
Method Summary
 void action_engageEnemy()
           
 void action_jump()
           
 void action_rearm()
           
 void action_runAroundCloseMeds()
           
 void action_runAroundItems()
           
 void action_runToItem()
           
 void action_stopShooting()
           
private  Item chooseItem()
          Reasoning about what to do with seen item
the easiest way of handeling it will be just to take it every time, but what should we do when there are many of items laying in front of agent?
private  Weapon chooseWeapon()
          choose weapon according to the one he is currently holding has melee and see ranged => pick up ranged has ranged and see melee => pick up melee pick up first weapon he sees
private  boolean seeAnyReachableItemAndWantIt()
          sees reachable item and wants it
 boolean sense_armed()
           
 boolean sense_fail()
           
 boolean sense_hasBetterWeapon()
           
 int sense_health()
           
 boolean sense_isShooting()
           
 boolean sense_knowMedkits()
           
 boolean sense_seeEnemy()
           
 boolean sense_seeItemAndWantIt()
           
 boolean sense_stucked()
           
 boolean sense_succeed()
           
 
Methods inherited from class cz.cuni.sposhBot.java.JavaBehaviour
action_doNothing, getActions, getName, getSenses
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

choosenItem

protected Item choosenItem

previousChoosenItem

protected Item previousChoosenItem

itemsToRunAround

public java.util.ArrayList<Item> itemsToRunAround

medkitsToRunAround

public java.util.ArrayList<Item> medkitsToRunAround

jumped

protected boolean jumped

medsRestart

protected boolean medsRestart
Constructor Detail

MyBehaviour

public MyBehaviour(java.lang.String name,
                   java.util.logging.Logger log,
                   SPoshBot bot)
Method Detail

action_rearm

public void action_rearm()

action_engageEnemy

public void action_engageEnemy()

action_runAroundCloseMeds

public void action_runAroundCloseMeds()

action_runAroundItems

public void action_runAroundItems()

action_runToItem

public void action_runToItem()

action_stopShooting

public void action_stopShooting()

action_jump

public void action_jump()

sense_fail

public boolean sense_fail()
Overrides:
sense_fail in class JavaBehaviour

sense_succeed

public boolean sense_succeed()
Overrides:
sense_succeed in class JavaBehaviour

sense_stucked

public boolean sense_stucked()

sense_isShooting

public boolean sense_isShooting()

sense_hasBetterWeapon

public boolean sense_hasBetterWeapon()

sense_health

public int sense_health()

sense_knowMedkits

public boolean sense_knowMedkits()

sense_armed

public boolean sense_armed()

sense_seeEnemy

public boolean sense_seeEnemy()

sense_seeItemAndWantIt

public boolean sense_seeItemAndWantIt()

chooseWeapon

private Weapon chooseWeapon()
choose weapon according to the one he is currently holding
  1. has melee and see ranged => pick up ranged
  2. has ranged and see melee => pick up melee
  3. pick up first weapon he sees

Returns:
the choosen one weapon

chooseItem

private Item chooseItem()
Reasoning about what to do with seen item
the easiest way of handeling it will be just to take it every time, but what should we do when there are many of items laying in front of agent?
  1. choose weapon - choose the type he is lacking (melee/ranged)
  2. choose armor
  3. choose health - if the health is bellow normal maximum
  4. choose ammo - if it is suitable for possessed weapons
  5. ignore the item


seeAnyReachableItemAndWantIt

private boolean seeAnyReachableItemAndWantIt()
sees reachable item and wants it

Returns:
true if there is an item which is useful for agent