-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4b9bc0
commit 72b215a
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from __future__ import annotations | ||
|
||
from collections import defaultdict | ||
|
||
from adventofcode.utils.abstract import FileReaderSolution | ||
|
||
|
||
class Day08: | ||
pass | ||
|
||
|
||
class Day08PartA(Day08, FileReaderSolution): | ||
def solve(self, input_data: str) -> int: | ||
antennas: defaultdict[str, list[tuple[int, int]]] = defaultdict(list) | ||
for i, row in enumerate(input_data.splitlines()): | ||
for j, val in enumerate(row): | ||
if val != ".": | ||
antennas[val].append((i, j)) | ||
return -1 | ||
|
||
|
||
class Day08PartB(Day08, FileReaderSolution): | ||
def solve(self, input_data: str) -> int: | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
|
||
from adventofcode2024.day08 import Day08PartA | ||
|
||
|
||
class TestDay08PartA: | ||
def test_day08a_testdata(self, testdata): | ||
solution = Day08PartA() | ||
result = solution.solve(testdata) | ||
assert result == 14 | ||
|
||
@pytest.mark.xfail(reason="Not yet implemented", raises=NotImplementedError) | ||
@pytest.mark.parametrize(("input_data", "expected_result"), [("", ""), ("", "")]) | ||
def test_day08a_solve(self, input_data, expected_result): | ||
solution = Day08PartA() | ||
result = solution.solve(input_data) | ||
assert result == expected_result | ||
|
||
@pytest.mark.xfail(reason="Not yet implemented", raises=NotImplementedError) | ||
def test_day08a_data(self): | ||
"""Result we got when we did the real solution""" | ||
solution = Day08PartA() | ||
res = solution("day_08/day08.txt") | ||
assert res == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
|
||
from adventofcode2024.day08 import Day08PartB | ||
|
||
|
||
class TestDay08PartB: | ||
@pytest.mark.xfail(reason="Not yet implemented", raises=NotImplementedError) | ||
def test_day08b_testdata(self, testdata): | ||
solution = Day08PartB() | ||
result = solution.solve(testdata) | ||
assert result == 0 | ||
|
||
@pytest.mark.xfail(reason="Not yet implemented", raises=NotImplementedError) | ||
@pytest.mark.parametrize(("input_data", "expected_result"), [("", ""), ("", "")]) | ||
def test_day08b_solve(self, input_data, expected_result): | ||
solution = Day08PartB() | ||
result = solution.solve(input_data) | ||
assert result == expected_result | ||
|
||
@pytest.mark.xfail(reason="Not yet implemented", raises=NotImplementedError) | ||
def test_day08b_data(self): | ||
"""Result we got when we did the real solution""" | ||
solution = Day08PartB() | ||
res = solution("day_08/day08.txt") | ||
assert res == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
............ | ||
........0... | ||
.....0...... | ||
.......0.... | ||
....0....... | ||
......A..... | ||
............ | ||
............ | ||
........A... | ||
.........A.. | ||
............ | ||
............ |