Skip to content

Commit

Permalink
Update styling
Browse files Browse the repository at this point in the history
  • Loading branch information
RoelAdriaans committed Jan 29, 2025
1 parent c4b9bc0 commit 72b215a
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/adventofcode2024/day08.py
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
24 changes: 24 additions & 0 deletions tests/adventofcode2024/test_day08_a.py
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
25 changes: 25 additions & 0 deletions tests/adventofcode2024/test_day08_b.py
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
12 changes: 12 additions & 0 deletions tests/adventofcode2024/testdata/day_08/day08_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
............
........0...
.....0......
.......0....
....0.......
......A.....
............
............
........A...
.........A..
............
............

0 comments on commit 72b215a

Please sign in to comment.