From 921f795917fd297d1003ef869d1cbf9b8a6bd5db Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Thu, 8 Dec 2022 22:16:36 +0100 Subject: Day 8 [WIP] --- day8/__init__.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 day8/__init__.py (limited to 'day8/__init__.py') diff --git a/day8/__init__.py b/day8/__init__.py new file mode 100644 index 0000000..21e18d2 --- /dev/null +++ b/day8/__init__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from abc import ABC +from typing import Iterator, Any, List + +from aoc import BaseAssignment + + +class Assignment(BaseAssignment): + trees: List[str] + + def row_at(self, y: int) -> List[int]: + return [int(i) for i in self.trees[y]] + + def col_at(self, x: int): + return [int(i[x]) for i in self.trees] + + def run(self, input: Iterator) -> Any: + self.trees = list(input) + + width = len(self.trees[0]) + height = len(self.trees) + + return ((width - 1) * 2) + ((height - 1) * 2) + + +class AssignmentOne(Assignment): + example_result = 21 -- cgit v1.2.3