diff options
Diffstat (limited to 'day2/__init__ (conflicted copy 2023-12-03 150713).py')
| -rw-r--r-- | day2/__init__ (conflicted copy 2023-12-03 150713).py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/day2/__init__ (conflicted copy 2023-12-03 150713).py b/day2/__init__ (conflicted copy 2023-12-03 150713).py deleted file mode 100644 index 1191e0f..0000000 --- a/day2/__init__ (conflicted copy 2023-12-03 150713).py +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from abc import ABC | ||
| 3 | from enum import Enum | ||
| 4 | from typing import Iterator | ||
| 5 | |||
| 6 | from aoc import BaseAssignment, I, T | ||
| 7 | |||
| 8 | |||
| 9 | class Color(Enum): | ||
| 10 | red = 'red' | ||
| 11 | green = 'green' | ||
| 12 | blue = 'blue' | ||
| 13 | |||
| 14 | ColorCount = tuple[int, Color] | ||
| 15 | |||
| 16 | class Assignment(BaseAssignment, ABC): | ||
| 17 | def parse_item(self, item: str) -> list[tuple[ColorCount, ...]]: | ||
| 18 | _, items = item.split(': ') | ||
| 19 | |||
| 20 | return [ | ||
| 21 | tuple( | ||
| 22 | tuple(( | ||
| 23 | int(_.split(' ')[0]), | ||
| 24 | Color(_.split(' ')[1]) | ||
| 25 | )) | ||
| 26 | for _ in pair.split(', ') | ||
| 27 | ) | ||
| 28 | for pair in items.split('; ') | ||
| 29 | ] | ||
| 30 | |||
| 31 | |||
| 32 | class AssignmentOne(Assignment): | ||
| 33 | example_result = 8 | ||
| 34 | def run(self, input: Iterator[I]) -> T: | ||
| 35 | for i in input: | ||
| 36 | print(i) | ||
| 37 | |||
| 38 | |||
| 39 | class AssignmentTwo(Assignment): | ||
| 40 | pass | ||
