Battleship

Solving Battleships with SAT

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

def exact_ship(prefix, x1, y1, size, d):
    "prefix is ignored"
    points = just_ship(None, x1, y1, size, d)
    water = [[xy,'~'] for xy in just_water(points)]
    points = [[xy,'#'] for xy in points]
    if size == 1:
        points[0][1] = 'O'
    if size >= 2 and d == 'E':
        points[0][1]  = '<'
        points[-1][1] = '>'
    if size >= 2 and d == 'S':
        points[0][1]  = '^'
        points[-1][1] = 'v'
    return dict(points + water)
Name:
Mail: (not shown)

Please type this: