-void read_weights(Color sideToMove) {
- WeightMobilityMidgame =
- compute_weight(get_option_value_int("Mobility (Middle Game)"),
- WeightMobilityMidgameInternal);
- WeightMobilityEndgame =
- compute_weight(get_option_value_int("Mobility (Endgame)"),
- WeightMobilityEndgameInternal);
- WeightPawnStructureMidgame =
- compute_weight(get_option_value_int("Pawn Structure (Middle Game)"),
- WeightPawnStructureMidgameInternal);
- WeightPawnStructureEndgame =
- compute_weight(get_option_value_int("Pawn Structure (Endgame)"),
- WeightPawnStructureEndgameInternal);
- WeightPassedPawnsMidgame =
- compute_weight(get_option_value_int("Passed Pawns (Middle Game)"),
- WeightPassedPawnsMidgameInternal);
- WeightPassedPawnsEndgame =
- compute_weight(get_option_value_int("Passed Pawns (Endgame)"),
- 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;
+void read_weights(Color us) {
+
+ WeightMobilityMidgame = weight_option("Mobility (Middle Game)", WeightMobilityMidgameInternal);
+ WeightMobilityEndgame = weight_option("Mobility (Endgame)", WeightMobilityEndgameInternal);
+ WeightPawnStructureMidgame = weight_option("Pawn Structure (Middle Game)", WeightPawnStructureMidgameInternal);
+ WeightPawnStructureEndgame = weight_option("Pawn Structure (Endgame)", WeightPawnStructureEndgameInternal);
+ WeightPassedPawnsMidgame = weight_option("Passed Pawns (Middle Game)", WeightPassedPawnsMidgameInternal);
+ WeightPassedPawnsEndgame = weight_option("Passed Pawns (Endgame)", WeightPassedPawnsEndgameInternal);
+
+ Color them = opposite_color(us);
+
+ WeightKingSafety[us] = weight_option("Cowardice", WeightKingSafetyInternal);
+ WeightKingSafety[them] = weight_option("Aggressiveness", WeightKingOppSafetyInternal);