Class BoardHistoryList


  • public class BoardHistoryList
    extends Object
    Linked list data structure to store board history
    • Constructor Detail

      • BoardHistoryList

        public BoardHistoryList​(BoardData data)
        Initialize a new board history list, whose first node is data
        Parameters:
        data - the data to be stored for the first entry
    • Method Detail

      • getGameInfo

        public GameInfo getGameInfo()
      • setGameInfo

        public void setGameInfo​(GameInfo gameInfo)
      • clear

        public void clear()
        Clear history.
      • add

        public void add​(BoardData data)
        Add new data after head. Overwrites any data that may have been stored after head.
        Parameters:
        data - the data to add
      • addOrGoto

        public void addOrGoto​(BoardData data)
      • addOrGoto

        public void addOrGoto​(BoardData data,
                              boolean newBranch)
      • previous

        public Optional<BoardData> previous()
        moves the pointer to the left, returns the data stored there
        Returns:
        data of previous node, Optional.empty if there is no previous node
      • toStart

        public void toStart()
      • next

        public Optional<BoardData> next()
        moves the pointer to the right, returns the data stored there
        Returns:
        the data of next node, Optional.empty if there is no next node
      • nextVariation

        public Optional<BoardData> nextVariation​(int idx)
        Moves the pointer to the variation number idx, returns the data stored there.
        Returns:
        the data of next node, Optional.empty if there is no variation with index.
      • getNext

        public Optional<BoardData> getNext()
        Does not change the pointer position
        Returns:
        the data stored at the next index, if any, Optional.empty otherwise.
      • getPrevious

        public Optional<BoardData> getPrevious()
        Does not change the pointer position.
        Returns:
        the data stored at the previous index, if any, Optional.empty otherwise.
      • getData

        public BoardData getData()
        Returns:
        the data of the current node
      • setStone

        public void setStone​(int[] coordinates,
                             Stone stone)
      • getStones

        public Stone[] getStones()
      • getLastMove

        public Optional<int[]> getLastMove()
      • getNextMove

        public Optional<int[]> getNextMove()
      • getLastMoveColor

        public Stone getLastMoveColor()
      • isBlacksTurn

        public boolean isBlacksTurn()
      • getZobrist

        public Zobrist getZobrist()
      • getMoveNumber

        public int getMoveNumber()
      • getMoveMNNumber

        public int getMoveMNNumber()
      • getMoveNumberList

        public int[] getMoveNumberList()
      • violatesSuperko

        public boolean violatesSuperko​(BoardData data)
        Parameters:
        data - the board position to check against superko
        Returns:
        whether or not the given position violates the superko rule at the head's state
      • violatesKoRule

        public boolean violatesKoRule​(BoardData data)
      • root

        public BoardHistoryNode root()
        Returns the root node
        Returns:
        root node
      • currentBranchLength

        public int currentBranchLength()
        Returns the length of current branch
        Returns:
        length of current branch
      • mainTrunkLength

        public int mainTrunkLength()
        Returns the length of main trunk
        Returns:
        length of main trunk