// evaluate_outposts() evaluates bishop and knight outpost squares public static Score evaluate_outposts(Position pos, EvalInfo ei, Square s, PieceType Pt, Color Us) { Color Them = (Us == ColorS.WHITE ? ColorS.BLACK : ColorS.WHITE); Debug.Assert(Pt == PieceTypeS.BISHOP || Pt == PieceTypeS.KNIGHT); // Initial bonus based on square Value bonus = Outpost[Pt == PieceTypeS.BISHOP ? 1 : 0][Types.relative_square(Us, s)]; // Increase bonus if supported by pawn, especially if the opponent has // no minor piece which can trade with the outpost piece. if (bonus != 0 && (ei.attackedBy[Us][PieceTypeS.PAWN] & BitBoard.SquareBB[s]) != 0) { if (0 == pos.pieces_color_piecetype(Them, PieceTypeS.KNIGHT) && 0 == (BitBoard.squares_of_color(s) & pos.pieces_color_piecetype(Them, PieceTypeS.BISHOP))) { bonus += bonus + bonus / 2; } else { bonus += bonus / 2; } } return(Types.make_score(bonus, bonus)); }