computeSize method

  1. @visibleForTesting
WallSize computeSize(
  1. Map<Stone, StoneStartPosition> stonesPositions
)

Compute the wall size from the stones positions.

Implementation

@visibleForTesting
WallSize computeSize(Map<Stone, StoneStartPosition> stonesPositions) {
  final posBottomRight = stonesPositions.map((key, value) => MapEntry(key,
      StoneStartPosition(x: value.x + key.width, y: value.y + key.height)));
  int maxX = 0, maxY = 0;
  posBottomRight.forEach((stone, pos) {
    maxX = max(maxX, pos.x);
    maxY = max(maxY, pos.y);
  });
  return WallSize(maxX, maxY);
}