grid property

AutonomyGrid get grid

The grid of size gridSize with the rover in the center, ready to draw on the UI.

Implementation

AutonomyGrid get grid {
  final result = empty;
  if (isPlayingBadApple) {
    for (final obstacle in data.obstacles) {
      markCell(result, obstacle, AutonomyCell.obstacle);
    }
    return result;
  }
  for (final path in data.path) {
    markCell(result, path, AutonomyCell.path);
  }
  for (final marker in markers) {
    markCell(result, marker, AutonomyCell.marker);
  }
  for (final obstacle in data.obstacles) {
    markCell(result, obstacle, AutonomyCell.obstacle);
  }
  // Marks the rover and destination -- these should be last
  if (data.hasDestination()) {
    markCell(result, data.destination, AutonomyCell.destination);
  }
  markCell(result, roverPosition, AutonomyCell.rover);
  return result;
}