-
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.
chore: days 16 and 17 scaffolded, test cases added
- Loading branch information
1 parent
4f4a526
commit 38674a3
Showing
12 changed files
with
320 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,5 @@ | ||
Register A: 30899381 | ||
Register B: 0 | ||
Register C: 0 | ||
|
||
Program: 2,4,1,1,7,5,4,0,0,3,1,6,5,5,3,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,15 @@ | ||
############### | ||
#.......#....E# | ||
#.#.###.#.###.# | ||
#.....#.#...#.# | ||
#.###.#####.#.# | ||
#.#.#.......#.# | ||
#.#.#####.###.# | ||
#...........#.# | ||
###.#.#####.#.# | ||
#...#.....#.#.# | ||
#.#.#.###.#.#.# | ||
#.....#...#.#.# | ||
#.###.#.#.#.#.# | ||
#S..#.....#...# | ||
############### |
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,17 @@ | ||
################# | ||
#...#...#...#..E# | ||
#.#.#.#.#.#.#.#.# | ||
#.#.#.#...#...#.# | ||
#.#.#.#.###.#.#.# | ||
#...#.#.#.....#.# | ||
#.#.#.#.#.#####.# | ||
#.#...#.#.#.....# | ||
#.#.#####.#.###.# | ||
#.#.#.......#...# | ||
#.#.###.#####.### | ||
#.#.#...#.....#.# | ||
#.#.#.#####.###.# | ||
#.#.#.........#.# | ||
#.#.#.#########.# | ||
#S#.............# | ||
################# |
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,5 @@ | ||
Register A: 729 | ||
Register B: 0 | ||
Register C: 0 | ||
|
||
Program: 0,1,5,4,3,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
Empty file.
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,37 @@ | ||
from __future__ import annotations | ||
|
||
import time | ||
from pathlib import Path | ||
|
||
DIR = Path(__file__).parent | ||
FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt" | ||
|
||
|
||
def part1(contents: str) -> int: | ||
total = 0 | ||
# TODO part 1 | ||
return total | ||
|
||
|
||
def part2(contents: str) -> int: | ||
total = 0 | ||
# TODO part 2 | ||
return total | ||
|
||
|
||
def main(): | ||
contents = FILE.read_text() | ||
|
||
_start1 = time.perf_counter() | ||
result1 = part1(contents=contents) | ||
_delta1 = time.perf_counter() - _start1 | ||
print(f">> Part 1: {result1} ({_delta1:.6f}s)") | ||
|
||
_start2 = time.perf_counter() | ||
result2 = part2(contents=contents) | ||
_delta2 = time.perf_counter() - _start2 | ||
print(f">> Part 2: {result2} ({_delta2:.6f}s)") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,35 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from .main import part1, part2 | ||
|
||
DIR = Path(__file__).parent | ||
TEST_FILE_EX1 = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}_ex1.txt" | ||
TEST_FILE_EX2 = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}_ex2.txt" | ||
EXPECTED_PART_1_EX1 = 7_036 | ||
EXPECTED_PART_1_EX2 = 11_048 | ||
EXPECTED_PART_2 = 456 # TODO replace! | ||
|
||
|
||
@pytest.mark.skip(reason=f"{DIR.stem} P1 incomplete") | ||
@pytest.mark.parametrize( | ||
"file, expected", | ||
[ | ||
(TEST_FILE_EX1, EXPECTED_PART_1_EX1), | ||
(TEST_FILE_EX2, EXPECTED_PART_1_EX2), | ||
], | ||
) | ||
def test_part1(file: Path, expected: int): | ||
contents = file.read_text() | ||
result = part1(contents=contents) | ||
assert result == expected | ||
|
||
|
||
@pytest.mark.skip(reason=f"{DIR.stem} P2 incomplete") | ||
def test_part2(): | ||
contents = TEST_FILE_EX1.read_text() | ||
result = part2(contents=contents) | ||
assert result == EXPECTED_PART_2 |
Empty file.
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,37 @@ | ||
from __future__ import annotations | ||
|
||
import time | ||
from pathlib import Path | ||
|
||
DIR = Path(__file__).parent | ||
FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt" | ||
|
||
|
||
def part1(contents: str) -> str: | ||
result = "" | ||
# TODO part 1 | ||
return result | ||
|
||
|
||
def part2(contents: str) -> str: | ||
result = "" | ||
# TODO part 2 | ||
return result | ||
|
||
|
||
def main(): | ||
contents = FILE.read_text() | ||
|
||
_start1 = time.perf_counter() | ||
result1 = part1(contents=contents) | ||
_delta1 = time.perf_counter() - _start1 | ||
print(f">> Part 1: {result1} ({_delta1:.6f}s)") | ||
|
||
_start2 = time.perf_counter() | ||
result2 = part2(contents=contents) | ||
_delta2 = time.perf_counter() - _start2 | ||
print(f">> Part 2: {result2} ({_delta2:.6f}s)") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,26 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from .main import part1, part2 | ||
|
||
DIR = Path(__file__).parent | ||
TEST_FILE = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}.txt" | ||
EXPECTED_PART_1 = "4,6,3,5,6,3,5,2,1,0" | ||
EXPECTED_PART_2 = "456" # TODO replace! | ||
|
||
|
||
@pytest.mark.skip(reason=f"{DIR.stem} P1 incomplete") | ||
def test_part1(): | ||
contents = TEST_FILE.read_text() | ||
result = part1(contents=contents) | ||
assert result == EXPECTED_PART_1 | ||
|
||
|
||
@pytest.mark.skip(reason=f"{DIR.stem} P2 incomplete") | ||
def test_part2(): | ||
contents = TEST_FILE.read_text() | ||
result = part2(contents=contents) | ||
assert result == EXPECTED_PART_2 |