|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.brics.bisimulationGame.controller.AIDefender
public class AIDefender
A computer player with the defender role. The defender is passed a partitioned state space and if there exists a perfect strategy.
If so, the defender proceeds as follows:
Field Summary | |
---|---|
private boolean |
alive
|
private GameModel |
gameModel
|
private MessagePasser |
messagePasser
|
private StateSpace |
stateSpace
|
private java.util.HashSet<CGNode> |
suspicious
A set of suspicious nodes. |
Fields inherited from interface dk.brics.bisimulationGame.controller.AI |
---|
AI_SLEEP |
Constructor Summary | |
---|---|
AIDefender(GameModel gameModel,
MessagePasser messagePasser,
StateSpace stateSpace,
boolean winning)
Creates a defender and, if there isn't a winning strategy, computes a set of suspicious configurations from a configuration graph. |
Method Summary | |
---|---|
private void |
defenderStep(att.grappa.Node toNode)
Send a message to the message passer with the name of the node we have chosen to step to. |
private att.grappa.Node |
getAnyNode(java.lang.String attackerAction,
int attackerSide)
Get any node which is the head of an edge from our current node, such that the edge label equals the attacker's action. |
private att.grappa.Node |
getPerfectNode(java.lang.String attackerAction,
int attackerSide)
Find a perfect node in the state space, i.e. a node which resides in the same block as the current node on the attacker's side. |
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 StateSpace stateSpace
private java.util.HashSet<CGNode> suspicious
private boolean alive
Constructor Detail |
---|
public AIDefender(GameModel gameModel, MessagePasser messagePasser, StateSpace stateSpace, boolean winning)
gameModel
- A game model from which to get the status and the LTSsmessagePasser
- Used for sending move messages to the human playerstateSpace
- Used for building a configuration graph and for looking up nodes in
a specific blockwinning
- Indicates if there is a perfect strategy for the defenderConfigurationGraph
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
private void defenderStep(att.grappa.Node toNode)
toNode
- The node we have chosen to step to.private att.grappa.Node getPerfectNode(java.lang.String attackerAction, int attackerSide)
attackerAction
- The attacker's actionattackerSide
- The attacker's side
private att.grappa.Node getAnyNode(java.lang.String attackerAction, int attackerSide)
attackerAction
- The attacker's actionattackerSide
- The attacker's side
public void kill()
AI
kill
in interface AI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |