summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
495a0fa)
Regression test of 40K games at 60 secs shows
this commit to be a 2-3 ELO regression.
So revert to original king safety.
bench:
8732553
}
// Evaluation weights, initialized from UCI options
}
// Evaluation weights, initialized from UCI options
- enum { Mobility, PawnStructure, PassedPawns, Space, KingSafety };
- struct Weight { int mg, eg; } Weights[5];
+ enum { Mobility, PawnStructure, PassedPawns, Space, KingDangerUs, KingDangerThem };
+ struct Weight { int mg, eg; } Weights[6];
typedef Value V;
#define S(mg, eg) make_score(mg, eg)
typedef Value V;
#define S(mg, eg) make_score(mg, eg)
//
// Values modified by Joona Kiiski
const Score WeightsInternal[] = {
//
// Values modified by Joona Kiiski
const Score WeightsInternal[] = {
- S(289, 344), S(233, 201), S(221, 273), S(46, 0), S(289, 0)
+ S(289, 344), S(233, 201), S(221, 273), S(46, 0), S(271, 0), S(307, 0)
};
// MobilityBonus[PieceType][attacked] contains bonuses for middle and end
};
// MobilityBonus[PieceType][attacked] contains bonuses for middle and end
const int BishopCheck = 2;
const int KnightCheck = 3;
const int BishopCheck = 2;
const int KnightCheck = 3;
- // KingDanger[attackUnits] contains the actual king danger weighted
- // scores, indexed by a calculated integer number.
- Score KingDanger[128];
+ // KingDanger[Color][attackUnits] contains the actual king danger weighted
+ // scores, indexed by color and by a calculated integer number.
+ Score KingDanger[COLOR_NB][128];
// apply_weight() weighs score 'v' by weight 'w' trying to prevent overflow
// apply_weight() weighs score 'v' by weight 'w' trying to prevent overflow
// Finally, extract the king danger score from the KingDanger[]
// array and subtract the score from evaluation.
// Finally, extract the king danger score from the KingDanger[]
// array and subtract the score from evaluation.
- score -= KingDanger[attackUnits];
+ score -= KingDanger[Us == Search::RootColor][attackUnits];
Weights[PawnStructure] = weight_option("Pawn Structure (Midgame)", "Pawn Structure (Endgame)", WeightsInternal[PawnStructure]);
Weights[PassedPawns] = weight_option("Passed Pawns (Midgame)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
Weights[Space] = weight_option("Space", "Space", WeightsInternal[Space]);
Weights[PawnStructure] = weight_option("Pawn Structure (Midgame)", "Pawn Structure (Endgame)", WeightsInternal[PawnStructure]);
Weights[PassedPawns] = weight_option("Passed Pawns (Midgame)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
Weights[Space] = weight_option("Space", "Space", WeightsInternal[Space]);
- Weights[KingSafety] = weight_option("King Safety", "King Safety", WeightsInternal[KingSafety]);
+ Weights[KingDangerUs] = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
+ Weights[KingDangerThem] = weight_option("Aggressiveness", "Aggressiveness", WeightsInternal[KingDangerThem]);
const double MaxSlope = 30;
const double Peak = 1280;
const double MaxSlope = 30;
const double Peak = 1280;
for (int t = 0, i = 1; i < 100; ++i)
{
t = int(std::min(Peak, std::min(0.4 * i * i, t + MaxSlope)));
for (int t = 0, i = 1; i < 100; ++i)
{
t = int(std::min(Peak, std::min(0.4 * i * i, t + MaxSlope)));
- KingDanger[i] = apply_weight(make_score(t, 0), Weights[KingSafety]);
+
+ KingDanger[1][i] = apply_weight(make_score(t, 0), Weights[KingDangerUs]);
+ KingDanger[0][i] = apply_weight(make_score(t, 0), Weights[KingDangerThem]);
LimitsType Limits;
std::vector<RootMove> RootMoves;
Position RootPos;
LimitsType Limits;
std::vector<RootMove> RootMoves;
Position RootPos;
Time::point SearchTime;
StateStackPtr SetupStates;
}
Time::point SearchTime;
StateStackPtr SetupStates;
}
static PolyglotBook book; // Defined static to initialize the PRNG only once
static PolyglotBook book; // Defined static to initialize the PRNG only once
- TimeMgr.init(Limits, RootPos.game_ply(), RootPos.side_to_move());
+ RootColor = RootPos.side_to_move();
+ TimeMgr.init(Limits, RootPos.game_ply(), RootColor);
int cf = Options["Contempt Factor"] * PawnValueEg / 100; // From centipawns
int cf = Options["Contempt Factor"] * PawnValueEg / 100; // From centipawns
- DrawValue[ RootPos.side_to_move()] = VALUE_DRAW - Value(cf);
- DrawValue[~RootPos.side_to_move()] = VALUE_DRAW + Value(cf);
+ DrawValue[ RootColor] = VALUE_DRAW - Value(cf);
+ DrawValue[~RootColor] = VALUE_DRAW + Value(cf);
log << "\nSearching: " << RootPos.fen()
<< "\ninfinite: " << Limits.infinite
<< " ponder: " << Limits.ponder
log << "\nSearching: " << RootPos.fen()
<< "\ninfinite: " << Limits.infinite
<< " ponder: " << Limits.ponder
- << " time: " << Limits.time[RootPos.side_to_move()]
- << " increment: " << Limits.inc[RootPos.side_to_move()]
+ << " time: " << Limits.time[RootColor]
+ << " increment: " << Limits.inc[RootColor]
<< " moves to go: " << Limits.movestogo
<< "\n" << std::endl;
}
<< " moves to go: " << Limits.movestogo
<< "\n" << std::endl;
}
extern LimitsType Limits;
extern std::vector<RootMove> RootMoves;
extern Position RootPos;
extern LimitsType Limits;
extern std::vector<RootMove> RootMoves;
extern Position RootPos;
extern Time::point SearchTime;
extern StateStackPtr SetupStates;
extern Time::point SearchTime;
extern StateStackPtr SetupStates;
<< "\n" << Options
<< "\nuciok" << sync_endl;
<< "\n" << Options
<< "\nuciok" << sync_endl;
+ else if (token == "eval")
+ {
+ Search::RootColor = pos.side_to_move(); // Ensure it is set
+ sync_cout << Eval::trace(pos) << sync_endl;
+ }
else if (token == "ucinewgame") TT.clear();
else if (token == "go") go(pos, is);
else if (token == "position") position(pos, is);
else if (token == "ucinewgame") TT.clear();
else if (token == "go") go(pos, is);
else if (token == "position") position(pos, is);
else if (token == "flip") pos.flip();
else if (token == "bench") benchmark(pos, is);
else if (token == "d") sync_cout << pos.pretty() << sync_endl;
else if (token == "flip") pos.flip();
else if (token == "bench") benchmark(pos, is);
else if (token == "d") sync_cout << pos.pretty() << sync_endl;
- else if (token == "eval") sync_cout << Eval::trace(pos) << sync_endl;
else if (token == "isready") sync_cout << "readyok" << sync_endl;
else
sync_cout << "Unknown command: " << cmd << sync_endl;
else if (token == "isready") sync_cout << "readyok" << sync_endl;
else
sync_cout << "Unknown command: " << cmd << sync_endl;
o["Passed Pawns (Midgame)"] << Option(100, 0, 200, on_eval);
o["Passed Pawns (Endgame)"] << Option(100, 0, 200, on_eval);
o["Space"] << Option(100, 0, 200, on_eval);
o["Passed Pawns (Midgame)"] << Option(100, 0, 200, on_eval);
o["Passed Pawns (Endgame)"] << Option(100, 0, 200, on_eval);
o["Space"] << Option(100, 0, 200, on_eval);
- o["King Safety"] << Option(100, 0, 200, on_eval);
+ o["Aggressiveness"] << Option(100, 0, 200, on_eval);
+ o["Cowardice"] << Option(100, 0, 200, on_eval);
o["Min Split Depth"] << Option(0, 0, 12, on_threads);
o["Threads"] << Option(1, 1, MAX_THREADS, on_threads);
o["Hash"] << Option(32, 1, 16384, on_hash_size);
o["Min Split Depth"] << Option(0, 0, 12, on_threads);
o["Threads"] << Option(1, 1, MAX_THREADS, on_threads);
o["Hash"] << Option(32, 1, 16384, on_hash_size);