From dee861a68211a811948cc4effa130fc4ee8b5851 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 29 Jul 2026 15:05:17 +0200 Subject: early return when no legal moves, skipping sort call --- src/bot.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/bot.cpp') diff --git a/src/bot.cpp b/src/bot.cpp index 0f8d12a..a1b4fb2 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -119,6 +119,9 @@ int ScoreMove(const Game *board, const Move &move) { std::vector GetSortedLegalMoves(Game *g) { auto moves = GetLegalMoves(g); + if (moves.size() == 0) { + return moves; + } std::sort(moves.begin(), moves.end(), [&](const Move &a, const Move &c) { return ScoreMove(g, a) > ScoreMove(g, c); }); -- cgit v1.2.3