diff --git a/src/ui/flutter/lib/mill/position.dart b/src/ui/flutter/lib/mill/position.dart index 9e0d99cd..ece7e740 100644 --- a/src/ui/flutter/lib/mill/position.dart +++ b/src/ui/flutter/lib/mill/position.dart @@ -171,8 +171,8 @@ class Position { return selectPieceSQ(makeSquare(file, rank)); } - bool putPiece(var pt, int index) { - var sq = indexToSquare[index]; + bool putPiece(var pt, int sq) { + var index = squareToIndex[sq]; if (sq == null) { print("putPiece skip index: $index"); diff --git a/src/ui/flutter/lib/routes/battle_page.dart b/src/ui/flutter/lib/routes/battle_page.dart index de3650b5..e7d64eff 100644 --- a/src/ui/flutter/lib/routes/battle_page.dart +++ b/src/ui/flutter/lib/routes/battle_page.dart @@ -73,7 +73,7 @@ class _BattlePageState extends State { //position //flag++; //position.putPiece(flag % 2 == 0 ? '@' : 'O', index); - if (position.putPiece('@', index) == false) { + if (position.putPiece('@', indexToSquare[index]) == false) { return; }