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('each ship once')
line = ''
for i in ships:
    cells = [f(*stuff) for stuff in all_ships if stuff[0] == i]
    line += '%s %i, ' % (ships[i], len(cells))
    root = tree_one(cnf, 'each ship once - %s' % i, cells)
    cnf.write_one(root)
print(line)
Name:
Mail: (not shown)

Please type this: