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 TypeMethodDescriptionvoid
Add new data after head.void
addNodeProperty
(String key, String value) void
void
void
void
void
clear()
Clear history.int
Returns the length of current branchvoid
flatten()
getData()
getEnd()
Optional
<int[]> int
int
int[]
getNext()
Does not change the pointer positiongetNext
(boolean includeDummy) Optional
<int[]> getNexts()
Does not change the pointer position.Stone[]
boolean
goToMoveNumber
(int moveNumber, boolean withinBranch) boolean
int
Returns the length of main trunkvoid
moveNumber
(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.void
void
void
void
void
void
void
previous()
moves the pointer to the left, returns the data stored therevoid
removeStone
(int x, int y, Stone color) root()
Returns the root nodevoid
setGameInfo
(GameInfo gameInfo) void
int
sync
(BoardHistoryList newList) void
void
toStart()
boolean
violatesKoRule
(BoardData data) boolean
violatesSuperko
(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
-