|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdice_war.AITemplate
public abstract class AITemplate
The template of AI, 2 necessary methods must be overridden: main() and arrangeNewDices(int nNewDice). You can extend this class and put the class in package dice_war.AI (so it's in the directory dice_war/AI/ ), then the client(UserInterface) will load it automatically. Read the example codes in dice_war.AI, you'll know how to write AI faster.
Field Summary | |
---|---|
boolean[][] |
edge
edge set of the graph, represented by adjacency matrix |
int[][] |
edgeList
edge set of the graph, represented by edge list |
int |
MAX_DICE
the max number of dices a node(vertex) can have |
int |
myCountry
the id of me, "nodes[i].country == myCountry" means node i is yours. |
Node[] |
nodes
vertex set of the graph, there are some nodes with "country = 0" which means they are holes, don't care them |
double[][] |
probabilityTable
probabitlity table, probabilityTable[i][j] means the winning probability about attack(i, j) |
Constructor Summary | |
---|---|
AITemplate()
|
Method Summary | |
---|---|
void |
appendNewDice(Node n)
append a dice to the node n |
protected abstract void |
arrangeNewDices(int nNewDice)
the core of game play, when it's your turn, UserInterface will call this method. |
void |
attack(int from,
int to)
attack the node 'to' by the node 'from' |
boolean |
isAttackable(int from,
int to)
see if the node 'from' can attack the node 'to' |
protected abstract void |
main()
the core of game play, when it's your turn, UserInterface will call this method. |
void |
run()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int MAX_DICE
public int myCountry
public Node[] nodes
public int[][] edgeList
public boolean[][] edge
public double[][] probabilityTable
Constructor Detail |
---|
public AITemplate()
Method Detail |
---|
public void attack(int from, int to)
public void appendNewDice(Node n)
public boolean isAttackable(int from, int to)
protected abstract void main()
protected abstract void arrangeNewDices(int nNewDice)
public final void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |