Class AbstractRoyaleNode
- java.lang.Object
-
- ai.nettogrof.battlesnake.treesearch.node.AbstractNode
-
- ai.nettogrof.battlesnake.treesearch.node.AbstractDecisionNode
-
- ai.nettogrof.battlesnake.treesearch.node.AbstractEvaluationNode
-
- ai.nettogrof.battlesnake.treesearch.search.royale.AbstractRoyaleNode
-
- Direct Known Subclasses:
RoyaleDuelNode
,RoyaleFourNode
,WrappedRoyaleNode
public abstract class AbstractRoyaleNode extends AbstractEvaluationNode
This abstract royale node class is the based of all node class, provide basic method use in any node for royale rules.- Version:
- Spring 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 protected
AbstractRoyaleNode(List<SnakeInfo> snakes, FoodInfo food, AbstractHazard hazard2, BoardInfo boardInfo)
Constructor with snakes and food information
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addFoodValue(int[][] board, int[] count)
Adding value if a food is in the controlled areaprotected void
adjustHazardScore()
Adjust our snake score according if our head is in hazardprotected void
adjustScodeBasedonBoardControl(int[][] board)
Adjust the score based on number of square controls by snakes The board array contain the snake number from 1 to X snakesAbstractHazard
getHazard()
Gets hazard information from this nodeprotected int[][]
initBoard()
Initiate the board arrayprotected void
listAreaControl()
Generate score based on the area control by the snake.private void
removeHazardZone(int[][] board)
Remove hazard from the control Area because there's no value to control hazard area-
Methods inherited from class ai.nettogrof.battlesnake.treesearch.node.AbstractEvaluationNode
addBasicLengthScore, addScoreDistance, addScoreDistanceAll, addSizeCompareScore, addToHash, applyNewHash, generateHash, setWinnerMaxScore
-
Methods inherited from class ai.nettogrof.battlesnake.treesearch.node.AbstractDecisionNode
countSnakeAlive, updateScore
-
Methods inherited from class ai.nettogrof.battlesnake.treesearch.node.AbstractNode
addChild, createNode, getBoardInfo, getChild, getChildCount, getFood, getScoreRatio, getSnakes, isExp, isSingleSnake, setExp, setPossibleMove, updateChildCount, updateScoreRatio
-
-
-
-
Constructor Detail
-
AbstractRoyaleNode
protected AbstractRoyaleNode(List<SnakeInfo> snakes, FoodInfo food, AbstractHazard hazard2, BoardInfo boardInfo)
Constructor with snakes and food information- Parameters:
snakes
- List of snakesfood
- Food informationhazard2
- Hazard InfoboardInfo
- Board Information
-
-
Method Detail
-
getHazard
public AbstractHazard getHazard()
Gets hazard information from this node- Overrides:
getHazard
in classAbstractNode
- Returns:
- Hazard info
-
adjustHazardScore
protected void adjustHazardScore()
Adjust our snake score according if our head is in hazard
-
listAreaControl
protected void listAreaControl()
Generate score based on the area control by the snake. Using a kind of voronoi algo.- Overrides:
listAreaControl
in classAbstractEvaluationNode
-
removeHazardZone
private void removeHazardZone(int[][] board)
Remove hazard from the control Area because there's no value to control hazard area- Parameters:
board
- Board array
-
adjustScodeBasedonBoardControl
protected void adjustScodeBasedonBoardControl(int[][] board)
Adjust the score based on number of square controls by snakes The board array contain the snake number from 1 to X snakes- Overrides:
adjustScodeBasedonBoardControl
in classAbstractEvaluationNode
- Parameters:
board
- Board array
-
addFoodValue
private void addFoodValue(int[][] board, int[] count)
Adding value if a food is in the controlled area- Parameters:
board
- Board arraycount
- Count array
-
initBoard
protected int[][] initBoard()
Initiate the board array- Overrides:
initBoard
in classAbstractEvaluationNode
- Returns:
- board array
-
-