Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

antichess
Class Zobrist  view Zobrist download Zobrist.java

java.lang.Object
  extended byantichess.Zobrist

public class Zobrist
extends java.lang.Object

Zobrist class handles the Zobrist algorithm for creating a zobrist key for a given board.


Field Summary
private  Board board
           
private  boolean debug
           
private  long key
           
private  java.util.Random randomGenerator
           
private  long[] turn
           
private  long[][][] zobristMatrix
           
 
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
 

Field Detail

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
Constructor Detail

Zobrist

public Zobrist(Board board)
Creates a Zobrist matrix for a specific board. Initializes key=0.

Method Detail

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