Package featurecat.lizzie.rules
Class BoardHistoryList
java.lang.Object
featurecat.lizzie.rules.BoardHistoryList
Linked list data structure to store board history
-
Constructor Summary
ConstructorsConstructorDescriptionBoardHistoryList(BoardData data) Initialize a new board history list, whose first node is data -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd new data after head.voidaddNodeProperty(String key, String value) voidvoidvoidvoidvoidclear()Clear history.intReturns the length of current branchvoidflatten()getData()getEnd()Optional<int[]> intintint[]getNext()Does not change the pointer positiongetNext(boolean includeDummy) Optional<int[]> getNexts()Does not change the pointer position.Stone[]booleangoToMoveNumber(int moveNumber, boolean withinBranch) booleanintReturns the length of main trunkvoidmoveNumber(int moveNumber) next()moves the pointer to the right, returns the data stored therenext(boolean includeDummay) nextVariation(int idx) Moves the pointer to the variation number idx, returns the data stored there.voidvoidvoidvoidvoidvoidvoidprevious()moves the pointer to the left, returns the data stored therevoidremoveStone(int x, int y, Stone color) root()Returns the root nodevoidsetGameInfo(GameInfo gameInfo) voidintsync(BoardHistoryList newList) voidvoidtoStart()booleanviolatesKoRule(BoardData data) booleanviolatesSuperko(BoardData data)
-
Constructor Details
-
BoardHistoryList
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
-
setGameInfo
-
shallowCopy
-
clear
public void clear()Clear history. -
add
Add new data after head. Overwrites any data that may have been stored after head.- Parameters:
data- the data to add
-
addOrGoto
-
addOrGoto
-
addOrGoto
-
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
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
-
nextVariation
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
Does not change the pointer position- Returns:
- the data stored at the next index, if any, Optional.empty otherwise.
-
getNext
-
getNexts
- Returns:
- nexts for display
-
getPrevious
Does not change the pointer position.- Returns:
- the data stored at the previous index, if any, Optional.empty otherwise.
-
getData
- Returns:
- the data of the current node
-
setStone
-
getStones
-
getLastMove
-
getNextMove
-
getLastMoveColor
-
isBlacksTurn
public boolean isBlacksTurn() -
getZobrist
-
getMoveNumber
public int getMoveNumber() -
getMoveMNNumber
public int getMoveMNNumber() -
getMoveNumberList
public int[] getMoveNumberList() -
getCurrentHistoryNode
-
violatesSuperko
- 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
-
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
-
pass
-
pass
-
pass
-
pass
-
place
-
place
-
place
-
addNodeProperty
-
moveNumber
public void moveNumber(int moveNumber) -
addStone
-
removeStone
-
flatten
public void flatten() -
goToMoveNumber
public boolean goToMoveNumber(int moveNumber, boolean withinBranch) -
sync
-