squareDownLeftUp method

bool squareDownLeftUp(
  1. List<int> colors,
  2. [int? n]
)

Color with a square shape from the current position.

Requires a list of colors.

Implementation

bool squareDownLeftUp(List<int> colors, [int? n]) {
  final int originalRow = move.row;
  final int originalColumn = move.column;
  if (move.down(1, false) && move.left(1, false) && move.up(1, false)) {
    move.toPosition(originalRow, originalColumn);
    color(colors[0 % colors.length]);
    move.down();
    color(colors[1 % colors.length]);
    move.left();
    color(colors[2 % colors.length]);
    move.up();
    color(colors[3 % colors.length]);

    return true;
  }
  move.toPosition(originalRow, originalColumn);

  return false;
}