mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Cleanup read_weights() in evaluate.cpp
Exception to 80 colums rule here, but result seems better. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
dfcfed6432
commit
ca891e9760
1 changed files with 19 additions and 26 deletions
|
@ -63,6 +63,7 @@ namespace {
|
||||||
const int WeightPassedPawnsMidgameInternal = 0x100;
|
const int WeightPassedPawnsMidgameInternal = 0x100;
|
||||||
const int WeightPassedPawnsEndgameInternal = 0x100;
|
const int WeightPassedPawnsEndgameInternal = 0x100;
|
||||||
const int WeightKingSafetyInternal = 0x100;
|
const int WeightKingSafetyInternal = 0x100;
|
||||||
|
const int WeightKingOppSafetyInternal = 0x100;
|
||||||
|
|
||||||
// Visually better to define tables constants
|
// Visually better to define tables constants
|
||||||
typedef Value V;
|
typedef Value V;
|
||||||
|
@ -538,32 +539,24 @@ void quit_eval() {
|
||||||
/// read_weights() reads evaluation weights from the corresponding UCI
|
/// read_weights() reads evaluation weights from the corresponding UCI
|
||||||
/// parameters.
|
/// parameters.
|
||||||
|
|
||||||
void read_weights(Color sideToMove) {
|
int weight_option(const std::string& opt, int weight) {
|
||||||
WeightMobilityMidgame =
|
|
||||||
compute_weight(get_option_value_int("Mobility (Middle Game)"),
|
return compute_weight(get_option_value_int(opt), weight);
|
||||||
WeightMobilityMidgameInternal);
|
}
|
||||||
WeightMobilityEndgame =
|
|
||||||
compute_weight(get_option_value_int("Mobility (Endgame)"),
|
void read_weights(Color us) {
|
||||||
WeightMobilityEndgameInternal);
|
|
||||||
WeightPawnStructureMidgame =
|
WeightMobilityMidgame = weight_option("Mobility (Middle Game)", WeightMobilityMidgameInternal);
|
||||||
compute_weight(get_option_value_int("Pawn Structure (Middle Game)"),
|
WeightMobilityEndgame = weight_option("Mobility (Endgame)", WeightMobilityEndgameInternal);
|
||||||
WeightPawnStructureMidgameInternal);
|
WeightPawnStructureMidgame = weight_option("Pawn Structure (Middle Game)", WeightPawnStructureMidgameInternal);
|
||||||
WeightPawnStructureEndgame =
|
WeightPawnStructureEndgame = weight_option("Pawn Structure (Endgame)", WeightPawnStructureEndgameInternal);
|
||||||
compute_weight(get_option_value_int("Pawn Structure (Endgame)"),
|
WeightPassedPawnsMidgame = weight_option("Passed Pawns (Middle Game)", WeightPassedPawnsMidgameInternal);
|
||||||
WeightPawnStructureEndgameInternal);
|
WeightPassedPawnsEndgame = weight_option("Passed Pawns (Endgame)", WeightPassedPawnsEndgameInternal);
|
||||||
WeightPassedPawnsMidgame =
|
|
||||||
compute_weight(get_option_value_int("Passed Pawns (Middle Game)"),
|
Color them = opposite_color(us);
|
||||||
WeightPassedPawnsMidgameInternal);
|
|
||||||
WeightPassedPawnsEndgame =
|
WeightKingSafety[us] = weight_option("Cowardice", WeightKingSafetyInternal);
|
||||||
compute_weight(get_option_value_int("Passed Pawns (Endgame)"),
|
WeightKingSafety[them] = weight_option("Aggressiveness", WeightKingOppSafetyInternal);
|
||||||
WeightPassedPawnsEndgameInternal);
|
|
||||||
WeightKingSafety[sideToMove] =
|
|
||||||
compute_weight(get_option_value_int("Cowardice"), WeightKingSafetyInternal);
|
|
||||||
WeightKingSafety[opposite_color(sideToMove)] =
|
|
||||||
compute_weight(get_option_value_int("Aggressiveness"),
|
|
||||||
WeightKingSafetyInternal);
|
|
||||||
WeightKingSafety[opposite_color(sideToMove)] =
|
|
||||||
(get_option_value_int("Aggressiveness") * 0x100) / 100;
|
|
||||||
|
|
||||||
init_safety();
|
init_safety();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue