X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.h;h=394a6f62ae06c8e01d949338b31c14f02ce4bec7;hp=5529eae108429e35fba55f9a1c7ec362c68c3789;hb=190aea4cdc6e8e165028803be846563da53f9330;hpb=6373e88b5b13d23646ff50944b49b74a96bb5915 diff --git a/src/endgame.h b/src/endgame.h index 5529eae1..394a6f62 100644 --- a/src/endgame.h +++ b/src/endgame.h @@ -33,9 +33,6 @@ enum EndgameType { // Evaluation functions - KK, // K vs K - KBK, // KB vs K - KNK, // KN vs K KNNK, // KNN vs K KXK, // Generic "mate lone king" eval KBNK, // KBN vs K @@ -55,6 +52,7 @@ enum EndgameType { KBPsK, // KB+pawns vs K KQKRPs, // KQ vs KR+pawns KRPKR, // KRP vs KR + KRPKB, // KRP vs KB KRPPKRP, // KRPP vs KRP KPsK, // King and pawns vs king KBPKB, // KBP vs KB @@ -66,9 +64,9 @@ enum EndgameType { }; -/// Endgame functions can be of two types according if return a Value or a -/// ScaleFactor. Type eg_fun::type equals to either ScaleFactor or Value -/// depending if the template parameter is 0 or 1. +/// Endgame functions can be of two types depending on whether they return a +/// Value or a ScaleFactor. Type eg_fun::type returns either ScaleFactor +/// or Value depending on whether the template parameter is 0 or 1. template struct eg_fun { typedef Value type; }; template<> struct eg_fun<1> { typedef ScaleFactor type; }; @@ -88,18 +86,18 @@ struct EndgameBase { template SCALE_FUNS)>::type> struct Endgame : public EndgameBase { - explicit Endgame(Color c) : strongerSide(c), weakerSide(~c) {} - Color color() const { return strongerSide; } + explicit Endgame(Color c) : strongSide(c), weakSide(~c) {} + Color color() const { return strongSide; } T operator()(const Position&) const; private: - Color strongerSide, weakerSide; + const Color strongSide, weakSide; }; -/// Endgames class stores in two std::map the pointers to endgame evaluation -/// and scaling base objects. Then we use polymorphism to invoke the actual -/// endgame function calling its operator() that is virtual. +/// The Endgames class stores the pointers to endgame evaluation and scaling +/// base objects in two std::map typedefs. We then use polymorphism to invoke +/// the actual endgame function by calling its virtual operator(). class Endgames {