Skip to content

Commit 1b2af05

Browse files
bpfliegelmcostalba
authored andcommitted
Junior promotion patch
Assumption: Junior sends promotions according to the side to move (ucase/lcase). Fact: Stockfish generally handles promotion lcase. Patch: Handling position fen input moves always with lcase promotions. Ported back by Portfish. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
1 parent caef319 commit 1b2af05

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/misc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern void dbg_mean_of(int v);
3838
extern void dbg_print();
3939

4040
class Position;
41-
extern Move move_from_uci(const Position& pos, const std::string& str);
41+
extern Move move_from_uci(const Position& pos, std::string str);
4242
extern const std::string move_to_uci(Move m, bool chess960);
4343
extern const std::string move_to_san(Position& pos, Move m);
4444

src/move.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
*/
1919

20+
#include <algorithm>
2021
#include <cassert>
2122
#include <string>
2223

@@ -56,7 +57,10 @@ const string move_to_uci(Move m, bool chess960) {
5657
/// simple coordinate notation and returns an equivalent Move if any.
5758
/// Moves are guaranteed to be legal.
5859

59-
Move move_from_uci(const Position& pos, const string& str) {
60+
Move move_from_uci(const Position& pos, string str) {
61+
62+
// Some GUIs, like Junior, could send promotion in uppercase
63+
std::transform(str.begin(), str.end(), str.begin(), tolower);
6064

6165
for (MoveList<MV_LEGAL> ml(pos); !ml.end(); ++ml)
6266
if (str == move_to_uci(ml.move(), pos.is_chess960()))

0 commit comments

Comments
 (0)