roverCellType property

AutonomyCell get roverCellType

The cell type of the rover that isn't AutonomyCell.rover

Implementation

AutonomyCell get roverCellType {
  final roverCoordinates = roverPosition.toGridBlock(centerPosition);

  if (data.hasDestination() &&
      data.destination.toGridBlock(centerPosition) == roverCoordinates) {
    return AutonomyCell.destination;
  } else if (data.obstacles.any(
    (e) => e.toGridBlock(centerPosition) == roverCoordinates,
  )) {
    return AutonomyCell.obstacle;
  } else if (markers.any(
    (e) => e.toGridBlock(centerPosition) == roverCoordinates,
  )) {
    return AutonomyCell.marker;
  } else if (data.path.any(
    (e) => e.toGridBlock(centerPosition) == roverCoordinates,
  )) {
    return AutonomyCell.path;
  }

  return AutonomyCell.empty;
}