parent
20a9cba06c
commit
d732503bf1
@ -0,0 +1,36 @@ |
|||||||
|
#.....#...#.........###.#........#.. |
||||||
|
....#......###..#.#.###....#......## |
||||||
|
......#..###.......#.#.#.#..#....... |
||||||
|
......#......#.#....#.##....##.#.#.# |
||||||
|
...###.#.#.......#..#............... |
||||||
|
....##...#..#....##....#...#.#...... |
||||||
|
..##...#.###.....##....#.#..##.##... |
||||||
|
..##....#.#......#.#...#.#...#.#.... |
||||||
|
.#.##..##......##..#...#.....##...## |
||||||
|
.......##.....#.....##..#..#..#..... |
||||||
|
..#..#...#......#..##...#.#...#...## |
||||||
|
......##.##.#.#.###....#.#..#......# |
||||||
|
#..#.#...#.....#...#...####.#..#...# |
||||||
|
...##...##.#..#.....####.#....##.... |
||||||
|
.#....###.#...#....#..#......#...... |
||||||
|
.##.#.#...#....##......#.....##...## |
||||||
|
.....#....###...#.....#....#........ |
||||||
|
...#...#....##..#.#......#.#.#...... |
||||||
|
.#..###............#.#..#...####.##. |
||||||
|
.#.###..#.....#......#..###....##..# |
||||||
|
#......#.#.#.#.#.#...#.#.#....##.... |
||||||
|
.#.....#.....#...##.#......#.#...#.. |
||||||
|
...##..###.........##.........#..... |
||||||
|
..#.#..#.#...#.....#.....#...###.#.. |
||||||
|
.#..........#.......#....#.......... |
||||||
|
...##..#..#...#..#...#......####.... |
||||||
|
.#..#...##.##..##..###......#....... |
||||||
|
.##.....#.......#..#...#..#.......#. |
||||||
|
#.#.#..#..##..#..............#....## |
||||||
|
..#....##......##.....#...#...##.... |
||||||
|
.##..##..#.#..#.................#### |
||||||
|
##.......#..#.#..##..#...#.......... |
||||||
|
#..##...#.##.#.#.........#..#..#.... |
||||||
|
.....#...#...#.#......#....#........ |
||||||
|
....#......###.#..#......##.....#..# |
||||||
|
#..#...##.........#.....##.....#.... |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
from math import atan2 |
||||||
|
import os |
||||||
|
from typing import Tuple |
||||||
|
|
||||||
|
|
||||||
|
inputfile = os.path.join(os.path.dirname(__file__), "input/day10_input") |
||||||
|
|
||||||
|
|
||||||
|
def calc_arc(origin: Tuple[int, int], target: Tuple[int, int]) -> float: |
||||||
|
return atan2(target[0] - origin[0], target[1] - origin[1]) |
||||||
|
|
||||||
|
|
||||||
|
def test_day10a(): |
||||||
|
with open(inputfile) as fp: |
||||||
|
lines = [x.rstrip() for x in fp.readlines()] |
||||||
|
asts = [(x, y) |
||||||
|
for x, line in enumerate(lines) |
||||||
|
for y, m in enumerate(line) |
||||||
|
if m == '#'] |
||||||
|
|
||||||
|
max = 0 |
||||||
|
for my in asts: |
||||||
|
angles = {calc_arc(my, target) for target in asts} |
||||||
|
max = len(angles) if len(angles) > max else max |
||||||
|
assert max == 303 |
||||||
Loading…
Reference in new issue