Skip to content

Commit

Permalink
Ensure 'x' move are only merged if last move doesn't contain '[' or ']'
Browse files Browse the repository at this point in the history
Modified the move processing logic to ensure that a move is only
appended to the last element in the mergedMoves list if the last
element does not contain the characters '[' or ']'.
  • Loading branch information
calcitem committed May 19, 2024
1 parent 799bb86 commit 3451ece
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ class _MoveListDialog extends StatelessWidget {

// Process each move and merge if necessary
for (final String move in moves) {
if (move.startsWith('x') && mergedMoves.isNotEmpty) {
if (move.startsWith('x') &&
mergedMoves.isNotEmpty &&
!mergedMoves[mergedMoves.length - 1].contains('[') &&
!mergedMoves[mergedMoves.length - 1].contains(']')) {
mergedMoves[mergedMoves.length - 1] += move;
} else {
mergedMoves.add(move);
Expand Down

0 comments on commit 3451ece

Please sign in to comment.