Symbolic can recognize all of the 146 different 2-5 man endgame classes. A particular endgame class is identified by a binary search of a table of 292 (= 146 * 2) material distribution signatures (not hashes). The table search looks for both a direct and color reversed match at the same time and is very fast. This code is mostly used for the tablebase probing. (The Zobrist material hash is used for other stuff.)
With the thought that it may be useful to those writing their own chess program, here is Symbolic's lexicographically ordered endgame class name array:
Code: Select all
const std::string Material::EndgameNameVec[EgkLen] =
{
"KBBBK",
"KBBK",
"KBBKB",
"KBBKN",
"KBBKP",
"KBBKQ",
"KBBKR",
"KBBNK",
"KBBPK",
"KBK",
"KBKB",
"KBKN",
"KBKP",
"KBNK",
"KBNKB",
"KBNKN",
"KBNKP",
"KBNKQ",
"KBNKR",
"KBNNK",
"KBNPK",
"KBPK",
"KBPKB",
"KBPKN",
"KBPKP",
"KBPKQ",
"KBPKR",
"KBPPK",
"KK",
"KNK",
"KNKN",
"KNKP",
"KNNK",
"KNNKB",
"KNNKN",
"KNNKP",
"KNNKQ",
"KNNKR",
"KNNNK",
"KNNPK",
"KNPK",
"KNPKB",
"KNPKN",
"KNPKP",
"KNPKQ",
"KNPKR",
"KNPPK",
"KPK",
"KPKP",
"KPPK",
"KPPKB",
"KPPKN",
"KPPKP",
"KPPKQ",
"KPPKR",
"KPPPK",
"KQBBK",
"KQBK",
"KQBKB",
"KQBKN",
"KQBKP",
"KQBKQ",
"KQBKR",
"KQBNK",
"KQBPK",
"KQK",
"KQKB",
"KQKN",
"KQKP",
"KQKQ",
"KQKR",
"KQNK",
"KQNKB",
"KQNKN",
"KQNKP",
"KQNKQ",
"KQNKR",
"KQNNK",
"KQNPK",
"KQPK",
"KQPKB",
"KQPKN",
"KQPKP",
"KQPKQ",
"KQPKR",
"KQPPK",
"KQQBK",
"KQQK",
"KQQKB",
"KQQKN",
"KQQKP",
"KQQKQ",
"KQQKR",
"KQQNK",
"KQQPK",
"KQQQK",
"KQQRK",
"KQRBK",
"KQRK",
"KQRKB",
"KQRKN",
"KQRKP",
"KQRKQ",
"KQRKR",
"KQRNK",
"KQRPK",
"KQRRK",
"KRBBK",
"KRBK",
"KRBKB",
"KRBKN",
"KRBKP",
"KRBKQ",
"KRBKR",
"KRBNK",
"KRBPK",
"KRK",
"KRKB",
"KRKN",
"KRKP",
"KRKR",
"KRNK",
"KRNKB",
"KRNKN",
"KRNKP",
"KRNKQ",
"KRNKR",
"KRNNK",
"KRNPK",
"KRPK",
"KRPKB",
"KRPKN",
"KRPKP",
"KRPKQ",
"KRPKR",
"KRPPK",
"KRRBK",
"KRRK",
"KRRKB",
"KRRKN",
"KRRKP",
"KRRKQ",
"KRRKR",
"KRRNK",
"KRRPK",
"KRRRK"
};