|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.brics.bisim.controller.AIAttacker
public class AIAttacker
A computer player with the attacker role. The attacker is passed a partitioned state space and a boolean indicating if there exists a perfect strategy.
If so, the attacker proceeds as follows:
If not, use the following strategy:
Field Summary | |
---|---|
private boolean |
alive
|
private Strategy |
currentStrategy
|
private GameModel |
gameModel
|
private MessagePasser |
messagePasser
|
private java.util.HashMap<CGNode,Strategy> |
nodeMap
|
Fields inherited from interface dk.brics.bisim.controller.AI |
---|
AI_SLEEP |
Constructor Summary | |
---|---|
AIAttacker(GameModel gameModel,
MessagePasser messagePasser)
Constructs an attacker and builds a strategy for it. |
Method Summary | |
---|---|
private void |
attackerChoseSide()
Look up the side in the current strategy and send a message to the message passer. |
private void |
attackerStep()
Look up the current strategy and send a message to the message passer. |
private int |
chooseRandomSide()
Choose a random side. |
private int |
chooseSide()
Choose a side based on the number of choices on either side. |
private Strategy |
getDynamicStrategy()
Create a dynamic strategy. |
private Strategy |
getStrategy()
Returns the strategy at the current node pair. |
void |
kill()
Tell the AI to stop running. |
void |
run()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private GameModel gameModel
private MessagePasser messagePasser
private java.util.HashMap<CGNode,Strategy> nodeMap
private Strategy currentStrategy
private boolean alive
Constructor Detail |
---|
public AIAttacker(GameModel gameModel, MessagePasser messagePasser)
gameModel
- A game model from which to get the status and the LTSsmessagePasser
- Used for sending move messages to the human playerConfigurationGraph
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
private void attackerChoseSide()
private void attackerStep()
private int chooseSide()
private int chooseRandomSide()
private Strategy getStrategy()
private Strategy getDynamicStrategy()
public void kill()
AI
kill
in interface AI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |