Class AbstractStandardSearch

  • All Implemented Interfaces:
    Runnable
    Direct Known Subclasses:
    MctsSearch, RegularSearch

    public abstract class AbstractStandardSearch
    extends AbstractMCTS
    This abstract Standard search, provide basic method use in any search in battlesnake standard mode
    Version:
    Spring 2021
    Author:
    carl.lajeunesse
    • Constructor Detail

      • AbstractStandardSearch

        protected AbstractStandardSearch()
        Basic constructor
      • AbstractStandardSearch

        protected AbstractStandardSearch​(AbstractNode root,
                                         int width,
                                         int height)
        Constructor used to expand the tree once.
        Parameters:
        root - Root node
        width - Board width
        height - Board height
    • Method Detail

      • kill

        protected void kill​(SnakeInfo death,
                            List<SnakeInfo> all)
        Description copied from class: AbstractSearch
        This abstract method will be use to "kill" a snake
        Specified by:
        kill in class AbstractSearch
        Parameters:
        death - SnakeInfo of the snake to kill
        all - List of all snakeinfo
      • createSnakeInfo

        protected SnakeInfo createSnakeInfo​(SnakeInfo snake,
                                            int newHead,
                                            AbstractNode node)
        Description copied from class: AbstractSearch
        Create new SnakeInfo based on the current node and the new head square
        Specified by:
        createSnakeInfo in class AbstractSearch
        Parameters:
        snake - previous snakeInfo
        newHead - New head square
        node - Previous node
        Returns:
        new SnakeInfo
      • freeSpace

        protected boolean freeSpace​(int square,
                                    List<SnakeInfo> snakes,
                                    SnakeInfo yourSnake)
        Description copied from class: AbstractSearch
        Check if the snake can move on the square
        Specified by:
        freeSpace in class AbstractSearch
        Parameters:
        square - the int sqaure
        snakes - List of all snakes
        yourSnake - current Snake
        Returns:
        boolean free to move on that square