// *** INITIALIZATION *** // #region Initialization public void Initialize(Game game) { if (Condition != null && ConditionalBySquare == null) { ConditionalBySquare = new BitBoard[game.NumPlayers]; for (int player = 0; player < game.NumPlayers; player++) { ConditionalBySquare[player].SetAll(); for (int sq = 0; sq < game.Board.NumSquares; sq++) { Location location = game.Board.SquareToLocation(sq); location = game.Symmetry.Translate(player, location); if (!Condition(location)) { ConditionalBySquare[player].ClearBit(sq); } } } } }
public virtual void Initialize() { // build "nextStep" matrix for next square number in any direction from each square buildNextStepMatrix(); // build "flipSquare" matrix that translates square numbers for a player based on symmetry (mirror/rotational/etc.) buildFlipSquareMatrix(); // build the "directionLookup" matrix that determines what direction of travel to buildDirectionLookupMatrix(); // arrays to store material and quick-eval information that is updated incrementally playerMaterial = new int[Game.NumPlayers]; playerEndgameMaterial = new int[Game.NumPlayers]; midgameMaterialEval = new int[Game.NumPlayers]; endgameMaterialEval = new int[Game.NumPlayers]; pieceCountByType = new int[Game.NumPlayers, Game.NPieceTypes]; playerPieceBitboards = new BitBoard[Game.NumPlayers]; playerPieceBitboards64 = new BitBoard64[Game.NumPlayers]; pieceTypeBitboards = new BitBoard[Game.NumPlayers, Game.NPieceTypes]; pieceTypeBitboards64 = new BitBoard64[Game.NumPlayers, Game.NPieceTypes]; pieceTypeBitboardsSliced = new BitBoard[Game.NumPlayers, Game.NPieceTypes, 8]; for (int player = 0; player < Game.NumPlayers; player++) { playerMaterial[player] = 0; playerEndgameMaterial[player] = 0; midgameMaterialEval[player] = 0; endgameMaterialEval[player] = 0; playerPieceBitboards[player] = new BitBoard(NumSquares); for (int x = 0; x < Game.NPieceTypes; x++) { pieceCountByType[player, x] = 0; pieceTypeBitboards[player, x] = new BitBoard(NumSquares); for (int y = 0; y < 8; y++) { pieceTypeBitboardsSliced[player, x, y] = new BitBoard(NumSquares); } } } }