From a75619b8e5b401686994ea44bc97f72615fb972e Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 5 Dec 2020 10:55:41 +0800 Subject: [PATCH] =?UTF-8?q?flutter:=20=E8=A7=A3=E5=86=B3=20potison=20fen?= =?UTF-8?q?=20moves=20=E7=9A=84=20mvoes=20=E7=94=9F=E6=88=90=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=9C=89=E6=97=B6=E5=B8=A6=E5=90=83=E5=AD=90=E7=9D=80?= =?UTF-8?q?=E6=B3=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/flutter/lib/mill/position.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ui/flutter/lib/mill/position.dart b/src/ui/flutter/lib/mill/position.dart index a1d4f552..5f28ba5e 100644 --- a/src/ui/flutter/lib/mill/position.dart +++ b/src/ui/flutter/lib/mill/position.dart @@ -1494,16 +1494,19 @@ class Position { } String movesSinceLastRemove() { - // + int i; String moves = ""; int posAfterLastRemove = 0; print("recorder.movesCount = ${recorder.movesCount}"); - for (int i = recorder.movesCount - 1; i >= 0; i--) { + for (i = recorder.movesCount - 1; i >= 0; i--) { //if (recorder.moveAt(i).type == MoveType.remove) break; if (recorder.moveAt(i).move[0] == '-') break; - posAfterLastRemove = i; + } + + if (i >= 0) { + posAfterLastRemove = i + 1; } print("[movesSinceLastRemove] posAfterLastRemove = $posAfterLastRemove"); @@ -1514,6 +1517,12 @@ class Position { print("moves = $moves"); + var idx = moves.indexOf('-('); + if (idx != -1) { + print("moves[$idx] is -("); + assert(false); + } + return moves.length > 0 ? moves.substring(1) : ''; }