grid property

List<List<(GpsCoordinates, AutonomyCell)>> get grid

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

Implementation

List<List<(GpsCoordinates, AutonomyCell)>> get grid {
	final result = empty;
	for (final obstacle in data.obstacles) {
		markCell(result, obstacle, AutonomyCell.obstacle);
	}
    if (isPlayingBadApple) return result;
	for (final path in data.path) {
		markCell(result, path, AutonomyCell.path);
	}
	for (final marker in markers) {
		markCell(result, marker, AutonomyCell.marker);
	}
    // 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;
}