Class AbstractSquadSearch
- java.lang.Object
- 
- ai.nettogrof.battlesnake.treesearch.AbstractSearch
- 
- ai.nettogrof.battlesnake.treesearch.AbstractBestFirstSearch
- 
- ai.nettogrof.battlesnake.treesearch.AbstractMCTS
- 
- ai.nettogrof.battlesnake.treesearch.search.squad.AbstractSquadSearch
 
 
 
 
- 
- All Implemented Interfaces:
- Runnable
 - Direct Known Subclasses:
- SquadSearch
 
 public abstract class AbstractSquadSearch extends AbstractMCTS This abstract Squad search, provide basic method use in any search in battlesnake squad mode- Version:
- Spring 2021
- Author:
- carl.lajeunesse
 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractSquadSearch()Basic constructorprotectedAbstractSquadSearch(AbstractNode root, int width, int height)Constructor used to expand the tree once.protectedAbstractSquadSearch(AbstractNode root, int width, int height, long starttime, int timeout, GameRuleset rules)Constructor used to expand to do the tree search.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SnakeInfocreateSnakeInfo(SnakeInfo snake, int newHead, AbstractNode currentNode)Create new SnakeInfo based on the current node and the new head squareprotected booleanfreeSpace(int square, List<SnakeInfo> snakes, SnakeInfo currentSnake)Check if the snake can move on the squareprotected booleanfreeSpaceSquad(int square, List<SnakeInfo> snakes, SnakeInfo currentSnake)Check if the snake can move on the square for squad modeprotected voidkill(SnakeInfo death, List<SnakeInfo> all)This method will be use to "kill" a snakeprotected voidkillSquad(SnakeInfo death, List<SnakeInfo> all)This method will be use to "kill" a snake in squad- 
Methods inherited from class ai.nettogrof.battlesnake.treesearch.AbstractMCTSexecuteMCTS, getMCTSBestPath
 - 
Methods inherited from class ai.nettogrof.battlesnake.treesearch.AbstractBestFirstSearchgetBestChild, getbestChildValue, getBestPath, mergeList, updateFullListNode, updateListNode
 - 
Methods inherited from class ai.nettogrof.battlesnake.treesearch.AbstractSearchaddMove, checkHeadToHead, generateChild, generateChild, generateSnakeInfoDestination, getSmallestChild, merge, moveSnake, stopSearching
 
- 
 
- 
- 
- 
Constructor Detail- 
AbstractSquadSearchprotected AbstractSquadSearch() Basic constructor
 - 
AbstractSquadSearchprotected AbstractSquadSearch(AbstractNode root, int width, int height) Constructor used to expand the tree once.- Parameters:
- root- Root node
- width- Board width
- height- Board height
 
 - 
AbstractSquadSearchprotected AbstractSquadSearch(AbstractNode root, int width, int height, long starttime, int timeout, GameRuleset rules) Constructor used to expand to do the tree search.- Parameters:
- root- Root node
- width- Board width
- height- Board height
- starttime- starting time for the search in millisecond
- timeout- the time limit to run the search
- rules- Game ruleset
 
 
- 
 - 
Method Detail- 
killprotected void kill(SnakeInfo death, List<SnakeInfo> all) This method will be use to "kill" a snake- Specified by:
- killin class- AbstractSearch
- Parameters:
- death- SnakeInfo of the snake to kill
- all- List of all snakeinfo
 
 - 
killSquadprotected void killSquad(SnakeInfo death, List<SnakeInfo> all) This method will be use to "kill" a snake in squad- Parameters:
- death- SnakeInfo of the snake to kill
- all- List of all snakeinfo
 
 - 
createSnakeInfoprotected SnakeInfo createSnakeInfo(SnakeInfo snake, int newHead, AbstractNode currentNode) Description copied from class:AbstractSearchCreate new SnakeInfo based on the current node and the new head square- Specified by:
- createSnakeInfoin class- AbstractSearch
- Parameters:
- snake- previous snakeInfo
- newHead- New head square
- currentNode- Previous node
- Returns:
- new SnakeInfo
 
 - 
freeSpaceprotected boolean freeSpace(int square, List<SnakeInfo> snakes, SnakeInfo currentSnake)Description copied from class:AbstractSearchCheck if the snake can move on the square- Specified by:
- freeSpacein class- AbstractSearch
- Parameters:
- square- the int sqaure
- snakes- List of all snakes
- currentSnake- current Snake
- Returns:
- boolean free to move on that square
 
 - 
freeSpaceSquadprotected boolean freeSpaceSquad(int square, List<SnakeInfo> snakes, SnakeInfo currentSnake)Check if the snake can move on the square for squad mode- Parameters:
- square- the int square
- snakes- List of all snakes
- currentSnake- current Snake
- Returns:
- boolean free to move on that square
 
 
- 
 
-