Skip to content

Commit e51c5e6

Browse files
committed
2022 - Day 15 Wip
1 parent 95cef56 commit e51c5e6

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

python/2022/day15/day15.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from sys import maxsize
2+
3+
from python.download_input import get_input_content
4+
5+
6+
def first(data):
7+
8+
for line in data:
9+
print(line)
10+
11+
return 1
12+
13+
14+
def second(data):
15+
return 2
16+
17+
18+
if __name__ == "__main__":
19+
content = get_input_content(__file__)
20+
test_input = '''Sensor at x=2, y=18: closest beacon is at x=-2, y=15
21+
Sensor at x=9, y=16: closest beacon is at x=10, y=16
22+
Sensor at x=13, y=2: closest beacon is at x=15, y=3
23+
Sensor at x=12, y=14: closest beacon is at x=10, y=16
24+
Sensor at x=10, y=20: closest beacon is at x=10, y=16
25+
Sensor at x=14, y=17: closest beacon is at x=10, y=16
26+
Sensor at x=8, y=7: closest beacon is at x=2, y=10
27+
Sensor at x=2, y=0: closest beacon is at x=2, y=10
28+
Sensor at x=0, y=11: closest beacon is at x=2, y=10
29+
Sensor at x=20, y=14: closest beacon is at x=25, y=17
30+
Sensor at x=17, y=20: closest beacon is at x=21, y=22
31+
Sensor at x=16, y=7: closest beacon is at x=15, y=3
32+
Sensor at x=14, y=3: closest beacon is at x=15, y=3
33+
Sensor at x=20, y=1: closest beacon is at x=15, y=3'''
34+
if test_input:
35+
content = test_input.split('\n')
36+
37+
min_x = min_y = maxsize
38+
max_x = max_y = -maxsize
39+
40+
41+
42+
print(f'Le résultat de la première partie est :\n{first(content)}')
43+
44+
print(f'Le résultat de la deuxième partie est :\n{second(content)}')

python/2022/day15/input.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Sensor at x=1326566, y=3575946: closest beacon is at x=1374835, y=2000000
2+
Sensor at x=2681168, y=3951549: closest beacon is at x=3184941, y=3924923
3+
Sensor at x=3959984, y=1095746: closest beacon is at x=3621412, y=2239432
4+
Sensor at x=3150886, y=2479946: closest beacon is at x=3621412, y=2239432
5+
Sensor at x=3983027, y=2972336: closest beacon is at x=4012908, y=3083616
6+
Sensor at x=3371601, y=3853300: closest beacon is at x=3184941, y=3924923
7+
Sensor at x=3174612, y=3992719: closest beacon is at x=3184941, y=3924923
8+
Sensor at x=3316368, y=1503688: closest beacon is at x=3621412, y=2239432
9+
Sensor at x=3818181, y=2331216: closest beacon is at x=3621412, y=2239432
10+
Sensor at x=3960526, y=3229321: closest beacon is at x=4012908, y=3083616
11+
Sensor at x=61030, y=3045273: closest beacon is at x=-467419, y=2369316
12+
Sensor at x=3635583, y=3121524: closest beacon is at x=4012908, y=3083616
13+
Sensor at x=2813357, y=5535: closest beacon is at x=3595763, y=-77322
14+
Sensor at x=382745, y=1566522: closest beacon is at x=1374835, y=2000000
15+
Sensor at x=3585664, y=538632: closest beacon is at x=3595763, y=-77322
16+
Sensor at x=3979654, y=2158646: closest beacon is at x=3621412, y=2239432
17+
Sensor at x=3996588, y=2833167: closest beacon is at x=4012908, y=3083616
18+
Sensor at x=3249383, y=141800: closest beacon is at x=3595763, y=-77322
19+
Sensor at x=3847114, y=225529: closest beacon is at x=3595763, y=-77322
20+
Sensor at x=3668737, y=3720078: closest beacon is at x=3184941, y=3924923
21+
Sensor at x=1761961, y=680560: closest beacon is at x=1374835, y=2000000
22+
Sensor at x=2556636, y=2213691: closest beacon is at x=3621412, y=2239432
23+
Sensor at x=65365, y=215977: closest beacon is at x=346716, y=-573228
24+
Sensor at x=709928, y=2270200: closest beacon is at x=1374835, y=2000000
25+
Sensor at x=3673956, y=2670437: closest beacon is at x=4029651, y=2547743
26+
Sensor at x=3250958, y=3999227: closest beacon is at x=3184941, y=3924923
27+
Sensor at x=3009537, y=3292368: closest beacon is at x=3184941, y=3924923

0 commit comments

Comments
 (0)