Class BoardHistoryList

java.lang.Object
featurecat.lizzie.rules.BoardHistoryList

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

    • 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 Details

    • getGameInfo

      public GameInfo getGameInfo()
    • setGameInfo

      public void setGameInfo(GameInfo gameInfo)
    • shallowCopy

      public BoardHistoryList shallowCopy()
    • 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)
    • addOrGoto

      public void addOrGoto(BoardData data, boolean newBranch, boolean changeMove)
    • 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()
    • toBranchTop

      public void toBranchTop()
    • 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
    • next

      public Optional<BoardData> next(boolean includeDummay)
    • 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.
    • getNext

      public Optional<BoardData> getNext(boolean includeDummy)
    • getNexts

      public List<BoardHistoryNode> getNexts()
      Returns:
      nexts for display
    • 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()
    • getCurrentHistoryNode

      public BoardHistoryNode getCurrentHistoryNode()
    • 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
    • getEnd

      public BoardHistoryNode getEnd()
    • pass

      public void pass(Stone color)
    • pass

      public void pass(Stone color, boolean newBranch)
    • pass

      public void pass(Stone color, boolean newBranch, boolean dummy)
    • pass

      public void pass(Stone color, boolean newBranch, boolean dummy, boolean changeMove)
    • place

      public void place(int x, int y, Stone color)
    • place

      public void place(int x, int y, Stone color, boolean newBranch)
    • place

      public void place(int x, int y, Stone color, boolean newBranch, boolean changeMove)
    • addNodeProperty

      public void addNodeProperty(String key, String value)
    • moveNumber

      public void moveNumber(int moveNumber)
    • addStone

      public void addStone(int x, int y, Stone color)
    • removeStone

      public void removeStone(int x, int y, Stone color)
    • flatten

      public void flatten()
    • goToMoveNumber

      public boolean goToMoveNumber(int moveNumber, boolean withinBranch)
    • sync

      public int sync(BoardHistoryList newList)