-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
hello, i've used surge source code for my chess engine, when i create uci for my program with position command
position startpos moves e2e4 e7e5 g1f3 b8c6
A B C D E F G H
+---+---+---+---+---+---+---+---+
8 | r | . | b | q | k | b | n | Q | 8
+---+---+---+---+---+---+---+---+
7 | p | p | p | p | . | p | p | p | 7
+---+---+---+---+---+---+---+---+
6 | . | . | n | . | . | . | . | . | 6
+---+---+---+---+---+---+---+---+
5 | . | . | . | . | p | . | . | . | 5
+---+---+---+---+---+---+---+---+
4 | . | . | . | . | P | . | . | . | 4
+---+---+---+---+---+---+---+---+
3 | . | . | . | . | . | N | . | . | 3
+---+---+---+---+---+---+---+---+
2 | P | P | P | P | . | P | P | P | 2
+---+---+---+---+---+---+---+---+
1 | R | N | B | Q | K | B | . | R | 1
+---+---+---+---+---+---+---+---+
A B C D E F G H
FEN: r1bqkbnQ/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b - -
Hash: 0xb8b0a66d08b6cd99
After this, I got the Queen at H8 for no reasons. I think it is a small bug inside the play function when call it with string move.
...
else if (string_lower(token) == "startpos") {
// append default fen string to position
this->position = Position(DEFAULT_FEN);
iss >> token;
if (string_lower(token) == "moves") {
std::string move_line;
std::getline(iss, move_line);
std::string move;
for (char c : move_line) {
if (c == ' ') {
if (this->position.side_to_play == WHITE)
this->position.play<WHITE>(Move(move));
else if (this->position.side_to_play == BLACK)
this->position.play<BLACK>(Move(move));
move.clear();
}
else
move += c;
}
if (!move.empty()) {
if (this->position.side_to_play == WHITE)
this->position.play<WHITE>(Move(move));
else if (this->position.side_to_play == BLACK)
this->position.play<BLACK>(Move(move));
}
}
uci_output(position);
}
...This is my source code for position startpos moves command.
Thanks for your help and sorry for my weird english !`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels