- const int QueenContactCheckBonus = 6;
- const int RookContactCheckBonus = 4;
- const int QueenCheckBonus = 3;
- const int RookCheckBonus = 2;
- const int BishopCheckBonus = 1;
- const int KnightCheckBonus = 1;
-
- // InitKingDanger[Square] contains penalties based on the position of the
- // defending king, indexed by king's square (from white's point of view).
- const int InitKingDanger[] = {
- 2, 0, 2, 5, 5, 2, 0, 2,
- 2, 2, 4, 8, 8, 4, 2, 2,
- 7, 10, 12, 12, 12, 12, 10, 7,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15
- };
-
- // KingDangerTable[Color][attackUnits] contains the actual king danger
- // weighted scores, indexed by color and by a calculated integer number.
- Score KingDangerTable[COLOR_NB][128];
-
- // TracedTerms[Color][PieceType || TracedType] contains a breakdown of the
- // evaluation terms, used when tracing.
- Score TracedScores[COLOR_NB][16];
- std::stringstream TraceStream;
-
- enum TracedType {
- PST = 8, IMBALANCE = 9, MOBILITY = 10, THREAT = 11,
- PASSED = 12, UNSTOPPABLE = 13, SPACE = 14, TOTAL = 15
- };
-
- // Function prototypes
- template<bool Trace>
- Value do_evaluate(const Position& pos, Value& margin);
-
- template<Color Us>
- void init_eval_info(const Position& pos, EvalInfo& ei);
-
- template<Color Us, bool Trace>
- Score evaluate_pieces_of_color(const Position& pos, EvalInfo& ei, Score& mobility);
-
- template<Color Us, bool Trace>
- Score evaluate_king(const Position& pos, EvalInfo& ei, Value margins[]);
-
- template<Color Us, bool Trace>
- Score evaluate_threats(const Position& pos, EvalInfo& ei);
-
- template<Color Us, bool Trace>
- Score evaluate_passed_pawns(const Position& pos, EvalInfo& ei);
-
- template<Color Us>
- int evaluate_space(const Position& pos, EvalInfo& ei);
-
- Score evaluate_unstoppable_pawns(const Position& pos, EvalInfo& ei);
-
- Value interpolate(const Score& v, Phase ph, ScaleFactor sf);
- Score apply_weight(Score v, Score w);
- Score weight_option(const std::string& mgOpt, const std::string& egOpt, Score internalWeight);
- double to_cp(Value v);
- void trace_add(int idx, Score term_w, Score term_b = SCORE_ZERO);
- void trace_row(const char* name, int idx);
-}