Class AbstractDecisionNode
- java.lang.Object
-
- ai.nettogrof.battlesnake.treesearch.node.AbstractNode
-
- ai.nettogrof.battlesnake.treesearch.node.AbstractDecisionNode
-
- Direct Known Subclasses:
AbstractEvaluationNode
public abstract class AbstractDecisionNode extends AbstractNode
This abstract node class is the based of all node class, provide basic update Score Currently using Paranoid only, I hope to add MaxN soon- Version:
- Fall 2021
- Author:
- carl.lajeunesse
-
-
Field Summary
-
Fields inherited from class ai.nettogrof.battlesnake.treesearch.node.AbstractNode
allChildsCount, boardInfo, child, exp, food, hazard, ONE, possibleMove, score, scoreRatio, snakes
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDecisionNode()Basic constructorprotectedAbstractDecisionNode(List<SnakeInfo> snakes, FoodInfo food, BoardInfo boardInfo)Basic constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcomputePayoffMatrix(List<float[]> scores)Compute the payoff Matricprotected intcountSnakeAlive()Count the number of snake still aliveprivate voidfillBasicScore(float[] currentSnake, int currentLength, int scoreLength)private intfindBestIndex(List<float[]> scores)Find the best index in the payoff matrixprivate voidinitPayoffMatrix(List<float[]> scores)Initiate the payoff matrixvoidupdateScore()Update this node scoreprivate voidupdateScoreMultiplePossibleMove()Update score if more than 1 possible moveprivate voidupdateScoreSinglePossibleMove()Update score if just one possible move.-
Methods inherited from class ai.nettogrof.battlesnake.treesearch.node.AbstractNode
addChild, createNode, getBoardInfo, getChild, getChildCount, getFood, getHazard, getScoreRatio, getSnakes, isExp, isSingleSnake, setExp, setPossibleMove, updateChildCount, updateScoreRatio
-
-
-
-
Method Detail
-
updateScore
public void updateScore()
Update this node score- Specified by:
updateScorein classAbstractNode
-
updateScoreMultiplePossibleMove
private void updateScoreMultiplePossibleMove()
Update score if more than 1 possible move
-
computePayoffMatrix
private void computePayoffMatrix(List<float[]> scores)
Compute the payoff Matric- Parameters:
scores- List of score array
-
findBestIndex
private int findBestIndex(List<float[]> scores)
Find the best index in the payoff matrix- Parameters:
scores- List of score array- Returns:
- int the index
-
initPayoffMatrix
private void initPayoffMatrix(List<float[]> scores)
Initiate the payoff matrix- Parameters:
scores- List of score array
-
fillBasicScore
private void fillBasicScore(float[] currentSnake, int currentLength, int scoreLength)- Parameters:
currentSnake- Current snakecurrentLength- current node lengthscoreLength- score array length
-
updateScoreSinglePossibleMove
private void updateScoreSinglePossibleMove()
Update score if just one possible move.
-
countSnakeAlive
protected int countSnakeAlive()
Count the number of snake still alive- Returns:
- Number of snake alive
-
-