From 443c08b256cb7e2975c79ee885a43099de912262 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 15 May 2021 22:47:16 +0800 Subject: [PATCH] Partially fix #195: Error: Invalid Move: (none) 1. Initial movePriorityList 2. Add await to send(getPositionFen(position!)); and await send('go'); See: https://github.com/calcitem/Sanmill/issues/195 --- src/movegen.h | 7 ++++++- src/ui/flutter_app/lib/engine/native_engine.dart | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/movegen.h b/src/movegen.h index e3bff628..5ccaabc4 100644 --- a/src/movegen.h +++ b/src/movegen.h @@ -94,7 +94,12 @@ struct MoveList static void create(); static void shuffle(); - inline static std::array movePriorityList {SQ_NONE}; + inline static std::array movePriorityList { + SQ_16, SQ_18, SQ_20, SQ_22 , + SQ_24, SQ_26, SQ_28, SQ_30, SQ_8, SQ_10, SQ_12, SQ_14 , + SQ_17, SQ_19, SQ_21, SQ_23, + SQ_25, SQ_27, SQ_29, SQ_31, SQ_9, SQ_11, SQ_13, SQ_15 + }; inline static Square adjacentSquares[SQUARE_NB][MD_NB] = { {SQ_NONE} }; inline static Bitboard adjacentSquaresBB[SQUARE_NB] = { 0 }; diff --git a/src/ui/flutter_app/lib/engine/native_engine.dart b/src/ui/flutter_app/lib/engine/native_engine.dart index 663b5cbc..148d73b0 100644 --- a/src/ui/flutter_app/lib/engine/native_engine.dart +++ b/src/ui/flutter_app/lib/engine/native_engine.dart @@ -58,8 +58,8 @@ class NativeEngine extends Engine { Future search(Position? position) async { if (await isThinking()) await stopSearching(); - send(getPositionFen(position!)); - send('go'); + await send(getPositionFen(position!)); + await send('go'); final response = await waitResponse(['bestmove', 'nobestmove']);