cnf.comment('no overlapping ships')
for i,ship1 in enumerate(all_ships):
points1 = set(just_ship(*ship1))
water1 = just_water(points1)
occupied1 = points1 | water1
for ship2 in all_ships[i:]:
if ship1[0] == ship2[0]:
continue
points2 = set(just_ship(*ship2))
if occupied1 & points2:
cnf.write_one(-f(*ship1), -f(*ship2))
# (points1 & water2) would be redundant