Ejemplo n.º 1
0
        static int EvaluatePieceSquareTable(int[] table, PieceList pieceList, bool isWhite)
        {
            int value = 0;

            for (int i = 0; i < pieceList.Count; i++)
            {
                value += PieceSquareTable.Read(table, pieceList[i], isWhite);
            }
            return(value);
        }
Ejemplo n.º 2
0
        int EvaluatePieceSquareTables(int colourIndex, float endgamePhaseWeight)
        {
            int  value   = 0;
            bool isWhite = colourIndex == Board.WhiteIndex;

            value += EvaluatePieceSquareTable(PieceSquareTable.pawns, board.pawns[colourIndex], isWhite);
            value += EvaluatePieceSquareTable(PieceSquareTable.rooks, board.rooks[colourIndex], isWhite);
            value += EvaluatePieceSquareTable(PieceSquareTable.knights, board.knights[colourIndex], isWhite);
            value += EvaluatePieceSquareTable(PieceSquareTable.bishops, board.bishops[colourIndex], isWhite);
            value += EvaluatePieceSquareTable(PieceSquareTable.queens, board.queens[colourIndex], isWhite);
            int kingEarlyPhase = PieceSquareTable.Read(PieceSquareTable.kingMiddle, board.KingSquare[colourIndex], isWhite);

            value += (int)(kingEarlyPhase * (1 - endgamePhaseWeight));
            //value += PieceSquareTable.Read (PieceSquareTable.kingMiddle, board.KingSquare[colourIndex], isWhite);

            return(value);
        }