private static final List<List<Location>> gridWith(
     List<Location> topRow, Location topLeft, Location bottomLeft) {
   int rowCount = topLeft.equals(bottomLeft) ? 1 : topLeft.distanceFrom(bottomLeft) + 1;
   return Stream.iterate(topRow, row -> row.stream().map(Location::south).collect(toList()))
       .limit(rowCount)
       .collect(toList());
 }
 private static final List<Location> topRowWith(Location topLeft, Location topRight) {
   int columnCount = topLeft.equals(topRight) ? 1 : topLeft.distanceFrom(topRight) + 1;
   return Stream.iterate(topLeft, Location::east).limit(columnCount).collect(toList());
 }