java.lang.Object
antichess.Zobrist
- public class Zobrist
- extends java.lang.Object
Zobrist class handles the Zobrist algorithm for creating a zobrist key for a given board.
|
Constructor Summary |
Zobrist(Board board)
Creates a Zobrist matrix for a specific board. |
|
Method Summary |
void |
addPiece(Board board,
int type,
int color,
int col,
int row)
MUST BE CALLED WHEN BOARD IS CHANGED THROUGH A MOVE OR UNDOMOVE
Updates the key for the board update |
void |
deletePiece(Board board,
int type,
int color,
int col,
int row)
MUST BE CALLED WHEN BOARD IS CHANGED THROUGH A MOVE OR UNDOMOVE
Updates the key for the board update |
long |
getKey(Board board,
int nextTurn)
Returns a zobrist key for the board |
long |
getKey(java.lang.String boardStr,
int nextTurn)
Returns a zobrist key for the board |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
randomGenerator
private java.util.Random randomGenerator
zobristMatrix
private long[][][] zobristMatrix
board
private Board board
key
private long key
turn
private long[] turn
debug
private boolean debug
Zobrist
public Zobrist(Board board)
- Creates a Zobrist matrix for a specific board. Initializes key=0.
getKey
public long getKey(Board board,
int nextTurn)
- Returns a zobrist key for the board
getKey
public long getKey(java.lang.String boardStr,
int nextTurn)
- Returns a zobrist key for the board
deletePiece
public void deletePiece(Board board,
int type,
int color,
int col,
int row)
- MUST BE CALLED WHEN BOARD IS CHANGED THROUGH A MOVE OR UNDOMOVE
Updates the key for the board update
addPiece
public void addPiece(Board board,
int type,
int color,
int col,
int row)
- MUST BE CALLED WHEN BOARD IS CHANGED THROUGH A MOVE OR UNDOMOVE
Updates the key for the board update