copyCells method

void copyCells(
  1. List<String> origin,
  2. List<String> destination
)

It takes a list of origin cells and a list of destination cells, the color of the origin cells is copied to the destination cells. Args: origin (List): Origin cells from where to copy the colors destinations (List): Destination cells

Implementation

void copyCells(List<String> origin, List<String> destination) {
  final StringBuffer buffer = StringBuffer();
  final Pair<List<String>, List<String>> newDestinationsAndColors =
      _copyCells(origin, destination);
  final List<String> newDestinations = newDestinationsAndColors.first;
  final List<String> colors = newDestinationsAndColors.second;
  for (int i = 0; i < newDestinations.length; i++) {
    buffer
      ..write(" go(${newDestinations[i]}) ")
      ..write(" paint(${colors[i]}) ");
  }
  _parse(buffer.toString(), false);
  _commandCaller.board.move.copyMode = false;
}