Beispiel #1
0
        private static int GetMobility(Board board, Piece piece, byte[] targets)
        {
            int result = 0;
            int row    = 13 * PieceIndex(piece);

            foreach (int square in targets)
            {
                Piece targetPiece = board[square];
                int   offset      = targetPiece.IsColor(piece) ? 6 : 0;
                result += MobilityValues[row + offset + Pieces.Order(targetPiece)];
            }
            //we return negative values if piece is black (black minimizes)
            return((int)piece.Color() * result);
        }