Solving Battleships with SAT
Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.
"remove ships that conflict with board givens"
knowns = set(xy for xy in table if table[xy] != '.')
for ship1 in all_ships:
points = exact_ship(*ship1)
okay = not any(points[xy] != table[xy] for xy in knowns & set(points))