Solving Battleships with SAT
Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.
def every_ship(prefix, size):
for x1,y1,d in product(xs, ys, 'SE'):
if size == 1 and d == 'S':
if d == 'E' and x1 + (size-1) not in xs:
if d == 'S' and y1 + (size-1) not in ys:
yield prefix, x1, y1, size, d