128 lines
1.4 KiB
Python

s = """
....#.....
....+---+#
....|...|.
..#.|...|.
....|..#|.
....|...|.
.#.O^---+.
........#.
#.........
......#...
....#.....
....+---+#
....|...|.
..#.|...|.
..+-+-+#|.
..|.|.|.|.
.#+-^-+-+.
......O.#.
#.........
......#...
....#.....
....+---+#
....|...|.
..#.|...|.
..+-+-+#|.
..|.|.|.|.
.#+-^-+-+.
.+----+O#.
#+----+...
......#...
....#.....
....+---+#
....|...|.
..#.|...|.
..+-+-+#|.
..|.|.|.|.
.#+-^-+-+.
..|...|.#.
#O+---+...
......#...
....#.....
....+---+#
....|...|.
..#.|...|.
..+-+-+#|.
..|.|.|.|.
.#+-^-+-+.
....|.|.#.
#..O+-+...
......#...
....#.....
....+---+#
....|...|.
..#.|...|.
..+-+-+#|.
..|.|.|.|.
.#+-^-+-+.
.+----++#.
#+----++..
......#O..
"""
ss = [i.strip() for i in s.strip().split('\n\n')]
ll = set([
(4, 3),
(7, 1),
(3, 6),
(6, 7),
(3, 8),
(1, 8),
(7, 7),
(7, 9),
])
def find_o(m):
x = 0
y = 0
ix = 0
while ix < len(m):
if m[ix] == 'O':
return (x, y)
if m[ix] == '\n':
y += 1
x = 0
else:
x += 1
ix += 1
oo = set([find_o(m) for m in ss])
print(oo)
print(ll - oo)
0123456789
0 ....#.....
1 ....|--O.#
2 ....|.|...
3 ..#.|.|...
4 ....|.|#..
5 ....|.|...
6 .#--------
7 .|....|.#.
8 #-----|...
9 ......#...
0123456789
0 ....#.....
1 .........#
2 ..........
3 ..#.......
4 .......#..
5 ..........
6 .#........
7 ........#.
8 #.........
9 ......#...