mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Fix wrong assert.
can trigger an abort when compiling with debug=yes, and using 7men TB. The assert should check that less than 8 pieces are in the key for each side, matching the assumption that underlies the FEN string construction. Also take explicitly care of a 'v' character in material strings. Fixes an issue reported in the forum: https://groups.google.com/d/msg/fishcooking/yoVC7etIpz0/7mS7ntZMBAAJ closes https://github.com/official-stockfish/Stockfish/pull/2547 No functional change.
This commit is contained in:
parent
0c878adb36
commit
0aee1ec4ab
1 changed files with 4 additions and 2 deletions
|
@ -375,11 +375,13 @@ void Position::set_state(StateInfo* si) const {
|
||||||
|
|
||||||
Position& Position::set(const string& code, Color c, StateInfo* si) {
|
Position& Position::set(const string& code, Color c, StateInfo* si) {
|
||||||
|
|
||||||
assert(code.length() > 0 && code.length() < 8);
|
|
||||||
assert(code[0] == 'K');
|
assert(code[0] == 'K');
|
||||||
|
|
||||||
string sides[] = { code.substr(code.find('K', 1)), // Weak
|
string sides[] = { code.substr(code.find('K', 1)), // Weak
|
||||||
code.substr(0, code.find('K', 1)) }; // Strong
|
code.substr(0, std::min(code.find('v'), code.find('K', 1))) }; // Strong
|
||||||
|
|
||||||
|
assert(sides[0].length() > 0 && sides[0].length() < 8);
|
||||||
|
assert(sides[1].length() > 0 && sides[1].length() < 8);
|
||||||
|
|
||||||
std::transform(sides[c].begin(), sides[c].end(), sides[c].begin(), tolower);
|
std::transform(sides[c].begin(), sides[c].end(), sides[c].begin(), tolower);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue