X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.cpp;h=572c160d42ba60c018a64bfbe13ed4c4403f42a1;hp=c50bb08ae500e506e04c98cec6abbb65e0f21c15;hb=d0587f2c7f31ea30885007beca76e832b8713501;hpb=df201175c6a0704800b1578e338c6e2a202234fe diff --git a/src/endgame.cpp b/src/endgame.cpp index c50bb08a..572c160d 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -82,8 +82,7 @@ namespace { // Get the material key of Position out of the given endgame key code // like "KBPKN". The trick here is to first forge an ad-hoc FEN string - // and then let a Position object do the work for us. Note that the - // FEN string could correspond to an illegal position. + // and then let a Position object do the work for us. Key key(const string& code, Color c) { assert(code.length() > 0 && code.length() < 8); @@ -94,8 +93,8 @@ namespace { std::transform(sides[c].begin(), sides[c].end(), sides[c].begin(), tolower); - string fen = sides[0] + char('0' + int(8 - code.length())) - + sides[1] + "/8/8/8/8/8/8/8 w - - 0 10"; + string fen = sides[0] + char(8 - sides[0].length() + '0') + "/8/8/8/8/8/8/" + + sides[1] + char(8 - sides[1].length() + '0') + " w - - 0 10"; return Position(fen, false, NULL).material_key(); }