mirrorCommands method

void mirrorCommands(
  1. List<String> commands,
  2. String direction
)

It creates a new command caller, copies the board from the old command caller, parses the commands, mirrors the board, and then joins the crosses from the new board to the old board.

Args: commands (List): The list of commands to mirror. direction (String): The direction to mirror the board.

Implementation

void mirrorCommands(List<String> commands, String direction) {
  final CommandCaller newCaller = CommandCaller(shape);
  final CommandCaller oldCaller = _commandCaller;
  _commandCaller = newCaller;
  _commandCaller.board.move.toPosition(
    oldCaller.board.move.row,
    oldCaller.board.move.column,
  );
  _parse(commands.join(","), false);
  mirrorBoard(direction);
  oldCaller.board.joinBoards(_commandCaller.board.getCross);
  _commandCaller = oldCaller;
}