cz.cuni.amis.pogamut.ut2004.hideandseek.bot
Class HSBotModule

Package class diagram package HSBotModule
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.module.AgentModule<AGENT>
      extended by cz.cuni.amis.pogamut.base.agent.module.SensorModule<UT2004Bot>
          extended by cz.cuni.amis.pogamut.ut2004.hideandseek.bot.HSBotModule
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.component.IComponent

public class HSBotModule
extends cz.cuni.amis.pogamut.base.agent.module.SensorModule<UT2004Bot>

BotHideAndSeekModule

Author:
Jimmy

Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.SensorModule
worldView
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
agent, controller, eventBus, log
 
Constructor Summary
HSBotModule(UT2004Bot agent, AgentInfo info, Players players)
           
 
Method Summary
protected  void beginMessage(BeginMessage event)
           
protected  void botKilled(BotKilled event)
           
 boolean canCaptureRunner()
          Tells you whether there is some RUNNER, who has been SPOTTED and was neither captured nor it escaped yet, thus it make sense to return to the safe-area to capture is.
protected  void cleanUp()
           
 List<HSBotRecord<Player>> getBotRecords(HSBotState botWhoAreInThisState)
          Returns list of known bots playing hide-and-seek in state 'botWhoAreInThisState'.
 HSBotState getBotState(cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId botId)
          If isRoundRunning(), returns state of 'botId' player in the game.
 HSGameConfig getGameConfig()
          Current game config - DO NOT SET ANYTHING!
 cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getGameRunningFlag()
          Whether HS-GAME has been started flag.
 HSGameState getGameState()
          Current detailed state of the game, see HSGameState.
 cz.cuni.amis.utils.flag.ImmutableFlag<HSGameState> getGameStateFlag()
          Current detailed state of the game, see HSGameState.
 cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId getId()
          Your BOT UnrealId.
 double getMyRestrictedAreaDistance()
          Returns distance between your bot and the restricted area, the number may be negative.
 double getMySafeAreaDistance()
          Returns distance betweenn your bot and the safe-area, the number may be negative.
 int getMyScore()
          Returns overall score of your bot.
 HSBotState getMyState()
          If round is running, returns HSBotState of your bot.
 double getRemainingHidingTime()
          If isRoundRunning(), returns time (in seconds) how much time runners have left to hide before the seeker is spawned.
 double getRemainingRestrictedAreaTime()
          If isRoundRunning(), returns time (in seconds) for how long runners cannot approach safe-area (cannot get into the restricted area).
 double getRemainingRoundTime()
          If isRoundRunning(), returns remaining round-time (in seconds), this time includes possible hiding-time and restricted-area-time.
 double getRestrictedAreaDistance(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
          Returns distance between 'located' from the 'restricted-area' including HSGameConfig.getRestrictedAreaRadius(), thus the returned number may be negative.
 cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getRoundRunningFlag()
          Whether GAME-ROUND is running.
 cz.cuni.amis.pogamut.base3d.worldview.object.Location getSafeArea()
          Precise location of the safe-area within the environment.
 double getSafeAreaDistance(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
          Returns distance between 'located' from the 'safe-area' including HSGameConfig.getSafeAreaRadius(), thus the returned number may be negative.
 NavPoint getSafeAreaNearestNavPoint()
          Returns nearest NavPoint to the safe-area.
 Player getSeeker()
          If Player object is known for the seeker, returns it.
 cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId getSeekerId()
          Returns UNREAL-ID of the seeker if already assigned.
 List<HSBotRecord<Player>> getSpottedRunnerRecords()
          Returns list of bot records who are in the HSBotState.RUNNER_SPOTTED.
protected  void hsAssignSeeker(HSAssignSeeker event)
           
protected  void hsBotStateChanged(HSBotStateChanged event)
           
protected  void hsGameEnd(HSGameEnd event)
           
protected  void hsGameStart(HSGameStart event)
           
protected  void hsPlayerScoreChanged(HSPlayerScoreChanged event)
           
protected  void hsRoundEnd(HSRoundEnd event)
           
protected  void hsRoundStart(HSRoundStart event)
           
protected  void hsRoundState(HSRoundState event)
           
protected  void hsRunnerCaptured(HSRunnerCaptured event)
           
protected  void hsRunnerFouled(HSRunnerFouled event)
           
protected  void hsRunnerSafe(HSRunnerSafe event)
           
protected  void hsRunnerSpotted(HSRunnerSpotted event)
           
protected  void hsRunnerSurvived(HSRunnerSurvived event)
           
 boolean isGameRunning()
          Whether HS-GAME has been started.
 boolean isHidingTime()
          If isRoundRunning(), returns whether seeker now have "hiding-time" period during which the seeker is not present within the environment.
 boolean isInRestrictedArea(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
          Whether 'located' is within the restricted-area given its position (HSGameConfig.getSafeArea()) and area radius (HSGameConfig.getRestrictedAreaRadius()).
 boolean isInRestrictedArea(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located, double tolerance)
          Whether 'located' is within the restricted-area given its position (HSGameConfig.getSafeArea()) and area radius (HSGameConfig.getRestrictedAreaRadius()).
 boolean isInSafeArea(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
          Whether 'located' is within the safe-area given its position (HSGameConfig.getSafeArea()) and area radius (HSGameConfig.getSafeAreaRadius()).
 boolean isMeAlive()
          Whether game round is running and I'm spawned, i.e., should be doing something.
 boolean isMeInRestrictedArea()
          Whether your bot is in the restricted area.
 boolean isMeInRestrictedArea(double tolerance)
          Whether your bot is in the restricted area enlarged given the tolerance.
 boolean isMeInSafeArea()
          Whether your bot is within the safe-area.
 boolean isMeRunner()
          If isRoundRunning() tells whether you are runner (true) or not (false), if round is NOT running, returns false.
 boolean isMeSeeker()
          If isRoundRunning() tells whether you are seeker (true) or not (false), if round is NOT running, returns false.
 boolean isRestrictedAreaActivated()
          If isRoundRunning(), returns whether restricted-area is activated, e.g., whether it will kill any runner stepping into it.
 boolean isRoundRunning()
          Whether GAME-ROUND is running.
 boolean isRunner(Player bot)
          If isRoundRunning(), returns whether 'bot' is runner.
 boolean isRunner(cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId botId)
          If isRoundRunning(), returns whether 'botId' is runner.
 boolean isSafeAreaApproachableByRunner()
          If isRoundRunning(), returns whether safe-area is approachable (== !
 boolean isSeeker(Player bot)
          If isRoundRunning(), returns whether 'bot' is seeker.
 boolean isSeeker(cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId botId)
          If isRoundRunning(), returns whether 'botId' is seeker.
 boolean isSeekerSpawned()
          If isRoundRunning(), returns whether seeker is present within the environment.
protected  void playerJoinsGame(PlayerJoinsGame event)
           
protected  void playerLeft(PlayerLeft event)
           
protected  void playerUpdate(cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectEvent<PlayerMessage> event)
           
protected  void spawn(Spawn event)
           
protected  void start(boolean startToPaused)
           
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HSBotModule

public HSBotModule(UT2004Bot agent,
                   AgentInfo info,
                   Players players)
Method Detail

getId

public cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId getId()
Your BOT UnrealId.

Returns:

isGameRunning

public boolean isGameRunning()
Whether HS-GAME has been started. This is not saying anything about "whether ROUND is running" or "current STATE of the game".

Returns:
See Also:
isRoundRunning(), getGameState()

getGameRunningFlag

public cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getGameRunningFlag()
Whether HS-GAME has been started flag. This is not saying anything about "whether ROUND is running" or "current STATE of the game".

Returns:
See Also:
getGameRunningFlag()

isRoundRunning

public boolean isRoundRunning()
Whether GAME-ROUND is running. This does not say anything about "current STATE of the round".

Returns:
See Also:
getGameState()

getRoundRunningFlag

public cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getRoundRunningFlag()
Whether GAME-ROUND is running. This does not say anything about "current STATE of the round".

Returns:
See Also:
getGameStateFlag()

getGameState

public HSGameState getGameState()
Current detailed state of the game, see HSGameState.

Returns:

getGameStateFlag

public cz.cuni.amis.utils.flag.ImmutableFlag<HSGameState> getGameStateFlag()
Current detailed state of the game, see HSGameState.

Returns:

isMeAlive

public boolean isMeAlive()
Whether game round is running and I'm spawned, i.e., should be doing something.

If true, you should examine getGameState() and getMyState() and act accordingly.

Returns:

isMeSeeker

public boolean isMeSeeker()
If isRoundRunning() tells whether you are seeker (true) or not (false),

if round is NOT running, returns false.

Returns:

isMeRunner

public boolean isMeRunner()
If isRoundRunning() tells whether you are runner (true) or not (false),

if round is NOT running, returns false.

Returns:

getMyState

public HSBotState getMyState()
If round is running, returns HSBotState of your bot.

If round is NOT running, returns null.

Returns:

getMyScore

public int getMyScore()
Returns overall score of your bot.

Returns:

isSeeker

public boolean isSeeker(cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId botId)
If isRoundRunning(), returns whether 'botId' is seeker.

If round is NOT running, returns false.

Parameters:
botId -
Returns:

isSeeker

public boolean isSeeker(Player bot)
If isRoundRunning(), returns whether 'bot' is seeker.

If round is NOT running, returns false.

Parameters:
botId -
Returns:

isRunner

public boolean isRunner(cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId botId)
If isRoundRunning(), returns whether 'botId' is runner.

If round is NOT running, returns false.

Parameters:
botId -
Returns:

isRunner

public boolean isRunner(Player bot)
If isRoundRunning(), returns whether 'bot' is runner.

If round is NOT running, returns false.

Parameters:
botId -
Returns:

canCaptureRunner

public boolean canCaptureRunner()
Tells you whether there is some RUNNER, who has been SPOTTED and was neither captured nor it escaped yet, thus it make sense to return to the safe-area to capture is.

Returns:

getSpottedRunnerRecords

public List<HSBotRecord<Player>> getSpottedRunnerRecords()
Returns list of bot records who are in the HSBotState.RUNNER_SPOTTED.

Note that HSBotRecord.getPlayer() might not be present!

Returns:

getBotRecords

public List<HSBotRecord<Player>> getBotRecords(HSBotState botWhoAreInThisState)
Returns list of known bots playing hide-and-seek in state 'botWhoAreInThisState'.

Note that HSBotRecord.getPlayer() might not be present!

Parameters:
botWhoAreEitherInThisState -
Returns:

getBotState

public HSBotState getBotState(cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId botId)
If isRoundRunning(), returns state of 'botId' player in the game.

If round is NOT running, returns null.

Parameters:
botId -
Returns:

isSeekerSpawned

public boolean isSeekerSpawned()
If isRoundRunning(), returns whether seeker is present within the environment.

If round is NOT running, returns false.

Returns:

isHidingTime

public boolean isHidingTime()
If isRoundRunning(), returns whether seeker now have "hiding-time" period during which the seeker is not present within the environment.

If round is NOT running, returns false.

Returns:

getRemainingHidingTime

public double getRemainingHidingTime()
If isRoundRunning(), returns time (in seconds) how much time runners have left to hide before the seeker is spawned.

If round is NOT running, returns Double.POSITIVE_INFINITY.

Returns:

isRestrictedAreaActivated

public boolean isRestrictedAreaActivated()
If isRoundRunning(), returns whether restricted-area is activated, e.g., whether it will kill any runner stepping into it.

If round is NOT running, returns false.

Returns:

getRemainingRestrictedAreaTime

public double getRemainingRestrictedAreaTime()
If isRoundRunning(), returns time (in seconds) for how long runners cannot approach safe-area (cannot get into the restricted area).

If round is NOT running, returns Double.POSITIVE_INFINITY.

Returns:

isSafeAreaApproachableByRunner

public boolean isSafeAreaApproachableByRunner()
If isRoundRunning(), returns whether safe-area is approachable (== !restricted-area-activated) for runners.

If round is NOT running, returns false.

Returns:

getSeekerId

public cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId getSeekerId()
Returns UNREAL-ID of the seeker if already assigned.

Returns:

getSeeker

public Player getSeeker()
If Player object is known for the seeker, returns it.

Returns:

getGameConfig

public HSGameConfig getGameConfig()
Current game config - DO NOT SET ANYTHING! Only for reading.

Returns:

getSafeArea

public cz.cuni.amis.pogamut.base3d.worldview.object.Location getSafeArea()
Precise location of the safe-area within the environment.

Returns:

getSafeAreaNearestNavPoint

public NavPoint getSafeAreaNearestNavPoint()
Returns nearest NavPoint to the safe-area.

Returns:

getSafeAreaDistance

public double getSafeAreaDistance(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
Returns distance between 'located' from the 'safe-area' including HSGameConfig.getSafeAreaRadius(), thus the returned number may be negative.

Parameters:
located -
Returns:

getMySafeAreaDistance

public double getMySafeAreaDistance()
Returns distance betweenn your bot and the safe-area, the number may be negative.

Returns:

isInSafeArea

public boolean isInSafeArea(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
Whether 'located' is within the safe-area given its position (HSGameConfig.getSafeArea()) and area radius (HSGameConfig.getSafeAreaRadius()).

Parameters:
located -
Returns:

isMeInSafeArea

public boolean isMeInSafeArea()
Whether your bot is within the safe-area.

Returns:

getRestrictedAreaDistance

public double getRestrictedAreaDistance(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
Returns distance between 'located' from the 'restricted-area' including HSGameConfig.getRestrictedAreaRadius(), thus the returned number may be negative.

Parameters:
located -
Returns:

getMyRestrictedAreaDistance

public double getMyRestrictedAreaDistance()
Returns distance between your bot and the restricted area, the number may be negative.

Returns:

isInRestrictedArea

public boolean isInRestrictedArea(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located)
Whether 'located' is within the restricted-area given its position (HSGameConfig.getSafeArea()) and area radius (HSGameConfig.getRestrictedAreaRadius()).

Parameters:
located -
Returns:

isMeInRestrictedArea

public boolean isMeInRestrictedArea()
Whether your bot is in the restricted area.

Returns:

isInRestrictedArea

public boolean isInRestrictedArea(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated located,
                                  double tolerance)
Whether 'located' is within the restricted-area given its position (HSGameConfig.getSafeArea()) and area radius (HSGameConfig.getRestrictedAreaRadius()).

Parameters:
located -
tolerance - added to the HSGameConfig.getRestrictedAreaRadius() when comparing distances from the safe-point
Returns:

isMeInRestrictedArea

public boolean isMeInRestrictedArea(double tolerance)
Whether your bot is in the restricted area enlarged given the tolerance.

Parameters:
tolerance - added to the HSGameConfig.getRestrictedAreaRadius() when comparing distances from the safe-point
Returns:

getRemainingRoundTime

public double getRemainingRoundTime()
If isRoundRunning(), returns remaining round-time (in seconds), this time includes possible hiding-time and restricted-area-time.

If round is NOT running, returns Double.POSITIVE_INFINITY.

Returns:

beginMessage

protected void beginMessage(BeginMessage event)

playerUpdate

protected void playerUpdate(cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectEvent<PlayerMessage> event)

playerLeft

protected void playerLeft(PlayerLeft event)

playerJoinsGame

protected void playerJoinsGame(PlayerJoinsGame event)

botKilled

protected void botKilled(BotKilled event)

spawn

protected void spawn(Spawn event)

hsAssignSeeker

protected void hsAssignSeeker(HSAssignSeeker event)

hsBotStateChanged

protected void hsBotStateChanged(HSBotStateChanged event)

hsGameEnd

protected void hsGameEnd(HSGameEnd event)

hsGameStart

protected void hsGameStart(HSGameStart event)

hsPlayerScoreChanged

protected void hsPlayerScoreChanged(HSPlayerScoreChanged event)

hsRoundEnd

protected void hsRoundEnd(HSRoundEnd event)

hsRoundStart

protected void hsRoundStart(HSRoundStart event)

hsRoundState

protected void hsRoundState(HSRoundState event)

hsRunnerCaptured

protected void hsRunnerCaptured(HSRunnerCaptured event)

hsRunnerFouled

protected void hsRunnerFouled(HSRunnerFouled event)

hsRunnerSafe

protected void hsRunnerSafe(HSRunnerSafe event)

hsRunnerSpotted

protected void hsRunnerSpotted(HSRunnerSpotted event)

hsRunnerSurvived

protected void hsRunnerSurvived(HSRunnerSurvived event)

start

protected void start(boolean startToPaused)
Overrides:
start in class cz.cuni.amis.pogamut.base.agent.module.AgentModule<UT2004Bot>

cleanUp

protected void cleanUp()
Overrides:
cleanUp in class cz.cuni.amis.pogamut.base.agent.module.AgentModule<UT2004Bot>


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.