Battleship

Solving Battleships with SAT

Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.

cnf.comment('apply clues to board')
for x in xs:
    if across[x] == '?':
        continue
    cells = [f(x,y) for y in ys]
    cnf.write(window(cells, across[x], across[x]))
for y in ys:
    if down[y] == '?':
        continue
    cells = [f(x,y) for x in xs]
    cnf.write(window(cells, down[y], down[y]))
Name:
Mail: (not shown)

Please type this: