aboutsummaryrefslogtreecommitdiff
path: root/src/uci.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uci.cpp')
-rw-r--r--src/uci.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/uci.cpp b/src/uci.cpp
index b98e6ce..6c035d5 100644
--- a/src/uci.cpp
+++ b/src/uci.cpp
@@ -286,6 +286,24 @@ static void positionCommnad(Game *game, std::string &cmd) {
MakeMove(move, game);
}
}
+static void movesCommnad(Game *g) {
+ auto moves = GetLegalMoves(g, ALL);
+ for (auto move : moves) {
+ Piece piece = g->pieces[getFromValueFromMove(move)];
+
+ Position from = IndexToPosition(getFromValueFromMove(move));
+ Position to = IndexToPosition(getToValueFromMove(move));
+ PieceType promotion = getPromotionTypeFromMove(move);
+
+ std::cout << static_cast<char>(from.file + 'a') << 1 + from.rank
+ << static_cast<char>(to.file + 'a') << 1 + to.rank;
+ std::cout << "\n";
+
+ if ((to.rank == 0 || to.rank == 7) && piece.type == PAWN) {
+ printPromotionLetter(promotion);
+ }
+ }
+};
void Uci() {
std::unordered_map<uint64_t, TranspositionsEntry> transpositions = {};
Game game = initBoard(starting_fen, &transpositions);
@@ -321,5 +339,8 @@ void Uci() {
if (cmd.starts_with("position")) {
positionCommnad(&game, cmd);
}
+ if (cmd == "moves") {
+ movesCommnad(&game);
+ }
}
}