Skip to content

Commit e4fc9d8

Browse files
committed
Retire eval weights UCI options
There is really little that user can achieve (apart from a weakened engine) tweaking these parameters that are already tuned and have no immediate or visible effect. So better do not expose them to the user and avoid the typical "What is the best setup for my machine?" kind of question (by far the most common, by far the most useless). No functional change.
1 parent 07a525c commit e4fc9d8

File tree

2 files changed

+4
-39
lines changed

2 files changed

+4
-39
lines changed

src/evaluate.cpp

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,15 @@ namespace {
8989
std::string do_trace(const Position& pos);
9090
}
9191

92-
// Evaluation weights, initialized from UCI options
92+
// Evaluation weights, indexed by evaluation term
9393
enum { Mobility, PawnStructure, PassedPawns, Space, KingDangerUs, KingDangerThem };
94-
struct Weight { int mg, eg; } Weights[6];
94+
const struct Weight { int mg, eg; } Weights[] = {
95+
{289, 344}, {233, 201}, {221, 273}, {46, 0}, {271, 0}, {307, 0}
96+
};
9597

9698
typedef Value V;
9799
#define S(mg, eg) make_score(mg, eg)
98100

99-
// Internal evaluation weights. These are applied on top of the evaluation
100-
// weights read from UCI parameters. The purpose is to be able to change
101-
// the evaluation weights while keeping the default values of the UCI
102-
// parameters at 100, which looks prettier.
103-
//
104-
// Values modified by Joona Kiiski
105-
const Score WeightsInternal[] = {
106-
S(289, 344), S(233, 201), S(221, 273), S(46, 0), S(271, 0), S(307, 0)
107-
};
108-
109101
// MobilityBonus[PieceType][attacked] contains bonuses for middle and end
110102
// game, indexed by piece type and number of attacked squares not occupied by
111103
// friendly pieces.
@@ -213,17 +205,6 @@ namespace {
213205
}
214206

215207

216-
// weight_option() computes the value of an evaluation weight, by combining
217-
// two UCI-configurable weights (midgame and endgame) with an internal weight.
218-
219-
Weight weight_option(const std::string& mgOpt, const std::string& egOpt, Score internalWeight) {
220-
221-
Weight w = { Options[mgOpt] * mg_value(internalWeight) / 100,
222-
Options[egOpt] * eg_value(internalWeight) / 100 };
223-
return w;
224-
}
225-
226-
227208
// init_eval_info() initializes king bitboards for given color adding
228209
// pawn attacks. To be done at the beginning of the evaluation.
229210

@@ -898,13 +879,6 @@ namespace Eval {
898879

899880
void init() {
900881

901-
Weights[Mobility] = weight_option("Mobility (Midgame)", "Mobility (Endgame)", WeightsInternal[Mobility]);
902-
Weights[PawnStructure] = weight_option("Pawn Structure (Midgame)", "Pawn Structure (Endgame)", WeightsInternal[PawnStructure]);
903-
Weights[PassedPawns] = weight_option("Passed Pawns (Midgame)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
904-
Weights[Space] = weight_option("Space", "Space", WeightsInternal[Space]);
905-
Weights[KingDangerUs] = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
906-
Weights[KingDangerThem] = weight_option("Aggressiveness", "Aggressiveness", WeightsInternal[KingDangerThem]);
907-
908882
const double MaxSlope = 30;
909883
const double Peak = 1280;
910884

src/ucioption.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ void init(OptionsMap& o) {
6060
o["Book File"] << Option("book.bin");
6161
o["Best Book Move"] << Option(false);
6262
o["Contempt Factor"] << Option(0, -50, 50);
63-
o["Mobility (Midgame)"] << Option(100, 0, 200, on_eval);
64-
o["Mobility (Endgame)"] << Option(100, 0, 200, on_eval);
65-
o["Pawn Structure (Midgame)"] << Option(100, 0, 200, on_eval);
66-
o["Pawn Structure (Endgame)"] << Option(100, 0, 200, on_eval);
67-
o["Passed Pawns (Midgame)"] << Option(100, 0, 200, on_eval);
68-
o["Passed Pawns (Endgame)"] << Option(100, 0, 200, on_eval);
69-
o["Space"] << Option(100, 0, 200, on_eval);
70-
o["Aggressiveness"] << Option(100, 0, 200, on_eval);
71-
o["Cowardice"] << Option(100, 0, 200, on_eval);
7263
o["Min Split Depth"] << Option(0, 0, 12, on_threads);
7364
o["Threads"] << Option(1, 1, MAX_THREADS, on_threads);
7465
o["Hash"] << Option(32, 1, 16384, on_hash_size);

0 commit comments

Comments
 (0)