projects
/
fairystockfish.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
4f38851
)
More robust shogi FEN parsing
author
Fabian Fichter
<ianfab@users.noreply.github.com>
Sun, 26 Sep 2021 15:54:14 +0000 (17:54 +0200)
committer
Fabian Fichter
<ianfab@users.noreply.github.com>
Sun, 26 Sep 2021 15:54:14 +0000 (17:54 +0200)
Closes #370.
src/position.cpp
patch
|
blob
|
history
diff --git
a/src/position.cpp
b/src/position.cpp
index
f51e349
..
96ad631
100644
(file)
--- a/
src/position.cpp
+++ b/
src/position.cpp
@@
-285,14
+285,15
@@
Position& Position::set(const Variant* v, const string& fenStr, bool isChess960,
put_piece(Piece(idx), sq, token == '~');
++sq;
}
+
// Promoted shogi pieces
- else if (token == '+')
+ else if (token == '+' && (idx = piece_to_char().find(ss.peek())) != string::npos)
{
ss >> token;
- idx = piece_to_char().find(token);
put_piece(make_piece(color_of(Piece(idx)), promoted_piece_type(type_of(Piece(idx)))), sq, true, Piece(idx));
++sq;
}
+
// Stop before pieces in hand
else if (token == '[')
break;