mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Retire "Pawn Structure" UCI option
Almost useless for the user and now is in sync with the material value that is already weighted. A small speedup of 0,4% because we avoid an apply_weight() call in a fast path. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
a10487b074
commit
8447248705
4 changed files with 17 additions and 12 deletions
|
@ -24,8 +24,6 @@ Use Search Log = false
|
||||||
Search Log Filename = SearchLog.txt
|
Search Log Filename = SearchLog.txt
|
||||||
Mobility (Middle Game) = 100
|
Mobility (Middle Game) = 100
|
||||||
Mobility (Endgame) = 100
|
Mobility (Endgame) = 100
|
||||||
Pawn Structure (Middle Game) = 100
|
|
||||||
Pawn Structure (Endgame) = 100
|
|
||||||
Passed Pawns (Middle Game) = 100
|
Passed Pawns (Middle Game) = 100
|
||||||
Passed Pawns (Endgame) = 100
|
Passed Pawns (Endgame) = 100
|
||||||
Space = 100
|
Space = 100
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace {
|
||||||
const int GrainSize = 8;
|
const int GrainSize = 8;
|
||||||
|
|
||||||
// Evaluation weights, initialized from UCI options
|
// Evaluation weights, initialized from UCI options
|
||||||
enum { Mobility, PawnStructure, PassedPawns, Space, KingDangerUs, KingDangerThem };
|
enum { Mobility, PassedPawns, Space, KingDangerUs, KingDangerThem };
|
||||||
Score Weights[6];
|
Score Weights[6];
|
||||||
|
|
||||||
typedef Value V;
|
typedef Value V;
|
||||||
|
@ -88,7 +88,7 @@ namespace {
|
||||||
//
|
//
|
||||||
// Values modified by Joona Kiiski
|
// Values modified by Joona Kiiski
|
||||||
const Score WeightsInternal[] = {
|
const Score WeightsInternal[] = {
|
||||||
S(248, 271), S(233, 201), S(252, 259), S(46, 0), S(247, 0), S(259, 0)
|
S(248, 271), S(252, 259), S(46, 0), S(247, 0), S(259, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
// MobilityBonus[PieceType][attacked] contains mobility bonuses for middle and
|
// MobilityBonus[PieceType][attacked] contains mobility bonuses for middle and
|
||||||
|
@ -301,7 +301,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
|
|
||||||
// Probe the pawn hash table
|
// Probe the pawn hash table
|
||||||
ei.pi = Threads[pos.thread()].pawnTable.get_pawn_info(pos);
|
ei.pi = Threads[pos.thread()].pawnTable.get_pawn_info(pos);
|
||||||
score += apply_weight(ei.pi->pawns_value(), Weights[PawnStructure]);
|
score += ei.pi->pawns_value();
|
||||||
|
|
||||||
// Initialize attack and king safety bitboards
|
// Initialize attack and king safety bitboards
|
||||||
init_eval_info<WHITE, HasPopCnt>(pos, ei);
|
init_eval_info<WHITE, HasPopCnt>(pos, ei);
|
||||||
|
@ -371,7 +371,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
{
|
{
|
||||||
trace_add(PST, pos.value());
|
trace_add(PST, pos.value());
|
||||||
trace_add(IMBALANCE, ei.mi->material_value());
|
trace_add(IMBALANCE, ei.mi->material_value());
|
||||||
trace_add(PAWN, apply_weight(ei.pi->pawns_value(), Weights[PawnStructure]));
|
trace_add(PAWN, ei.pi->pawns_value());
|
||||||
trace_add(MOBILITY, apply_weight(mobilityWhite, Weights[Mobility]), apply_weight(mobilityBlack, Weights[Mobility]));
|
trace_add(MOBILITY, apply_weight(mobilityWhite, Weights[Mobility]), apply_weight(mobilityBlack, Weights[Mobility]));
|
||||||
trace_add(THREAT, evaluate_threats<WHITE>(pos, ei), evaluate_threats<BLACK>(pos, ei));
|
trace_add(THREAT, evaluate_threats<WHITE>(pos, ei), evaluate_threats<BLACK>(pos, ei));
|
||||||
trace_add(PASSED, evaluate_passed_pawns<WHITE>(pos, ei), evaluate_passed_pawns<BLACK>(pos, ei));
|
trace_add(PASSED, evaluate_passed_pawns<WHITE>(pos, ei), evaluate_passed_pawns<BLACK>(pos, ei));
|
||||||
|
@ -405,7 +405,6 @@ void read_evaluation_uci_options(Color us) {
|
||||||
const int kingDangerThem = (us == WHITE ? KingDangerThem : KingDangerUs);
|
const int kingDangerThem = (us == WHITE ? KingDangerThem : KingDangerUs);
|
||||||
|
|
||||||
Weights[Mobility] = weight_option("Mobility (Middle Game)", "Mobility (Endgame)", WeightsInternal[Mobility]);
|
Weights[Mobility] = weight_option("Mobility (Middle Game)", "Mobility (Endgame)", WeightsInternal[Mobility]);
|
||||||
Weights[PawnStructure] = weight_option("Pawn Structure (Middle Game)", "Pawn Structure (Endgame)", WeightsInternal[PawnStructure]);
|
|
||||||
Weights[PassedPawns] = weight_option("Passed Pawns (Middle Game)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
|
Weights[PassedPawns] = weight_option("Passed Pawns (Middle Game)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
|
||||||
Weights[Space] = weight_option("Space", "Space", WeightsInternal[Space]);
|
Weights[Space] = weight_option("Space", "Space", WeightsInternal[Space]);
|
||||||
Weights[kingDangerUs] = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
|
Weights[kingDangerUs] = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
|
||||||
|
|
|
@ -61,7 +61,14 @@ namespace {
|
||||||
S(34,68), S(83,166), S(0, 0), S( 0, 0)
|
S(34,68), S(83,166), S(0, 0), S( 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const Score PawnStructureWeight = S(233, 201);
|
||||||
|
|
||||||
#undef S
|
#undef S
|
||||||
|
|
||||||
|
inline Score apply_weight(Score v, Score w) {
|
||||||
|
return make_score((int(mg_value(v)) * mg_value(w)) / 0x100,
|
||||||
|
(int(eg_value(v)) * eg_value(w)) / 0x100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,9 +102,12 @@ PawnInfo* PawnInfoTable::get_pawn_info(const Position& pos) const {
|
||||||
pi->pawnAttacks[WHITE] = ((wPawns << 9) & ~FileABB) | ((wPawns << 7) & ~FileHBB);
|
pi->pawnAttacks[WHITE] = ((wPawns << 9) & ~FileABB) | ((wPawns << 7) & ~FileHBB);
|
||||||
pi->pawnAttacks[BLACK] = ((bPawns >> 7) & ~FileABB) | ((bPawns >> 9) & ~FileHBB);
|
pi->pawnAttacks[BLACK] = ((bPawns >> 7) & ~FileABB) | ((bPawns >> 9) & ~FileHBB);
|
||||||
|
|
||||||
// Evaluate pawns for both colors
|
// Evaluate pawns for both colors and weight the result
|
||||||
pi->value = evaluate_pawns<WHITE>(pos, wPawns, bPawns, pi)
|
pi->value = evaluate_pawns<WHITE>(pos, wPawns, bPawns, pi)
|
||||||
- evaluate_pawns<BLACK>(pos, bPawns, wPawns, pi);
|
- evaluate_pawns<BLACK>(pos, bPawns, wPawns, pi);
|
||||||
|
|
||||||
|
pi->value = apply_weight(pi->value, PawnStructureWeight);
|
||||||
|
|
||||||
return pi;
|
return pi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,6 @@ OptionsMap::OptionsMap() {
|
||||||
o["Best Book Move"] = UCIOption(false);
|
o["Best Book Move"] = UCIOption(false);
|
||||||
o["Mobility (Middle Game)"] = UCIOption(100, 0, 200);
|
o["Mobility (Middle Game)"] = UCIOption(100, 0, 200);
|
||||||
o["Mobility (Endgame)"] = UCIOption(100, 0, 200);
|
o["Mobility (Endgame)"] = UCIOption(100, 0, 200);
|
||||||
o["Pawn Structure (Middle Game)"] = UCIOption(100, 0, 200);
|
|
||||||
o["Pawn Structure (Endgame)"] = UCIOption(100, 0, 200);
|
|
||||||
o["Passed Pawns (Middle Game)"] = UCIOption(100, 0, 200);
|
o["Passed Pawns (Middle Game)"] = UCIOption(100, 0, 200);
|
||||||
o["Passed Pawns (Endgame)"] = UCIOption(100, 0, 200);
|
o["Passed Pawns (Endgame)"] = UCIOption(100, 0, 200);
|
||||||
o["Space"] = UCIOption(100, 0, 200);
|
o["Space"] = UCIOption(100, 0, 200);
|
||||||
|
|
Loading…
Add table
Reference in a new issue