summaryrefslogtreecommitdiffstats
path: root/day8/__init__.py
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2022-12-08 22:16:36 +0100
committerGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2022-12-08 22:16:36 +0100
commit921f795917fd297d1003ef869d1cbf9b8a6bd5db (patch)
tree8e6f192a78dc5cc14dbb5274529d21d06f64b0c9 /day8/__init__.py
parent890670f34040c8570d30e589cbf82dfef3db6e67 (diff)
download2022-921f795917fd297d1003ef869d1cbf9b8a6bd5db.tar.gz
2022-921f795917fd297d1003ef869d1cbf9b8a6bd5db.tar.bz2
2022-921f795917fd297d1003ef869d1cbf9b8a6bd5db.zip
Day 8 [WIP]
Diffstat (limited to 'day8/__init__.py')
-rw-r--r--day8/__init__.py27
1 files changed, 27 insertions, 0 deletions
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 @@
1# -*- coding: utf-8 -*-
2from abc import ABC
3from typing import Iterator, Any, List
4
5from aoc import BaseAssignment
6
7
8class Assignment(BaseAssignment):
9 trees: List[str]
10
11 def row_at(self, y: int) -> List[int]:
12 return [int(i) for i in self.trees[y]]
13
14 def col_at(self, x: int):
15 return [int(i[x]) for i in self.trees]
16
17 def run(self, input: Iterator) -> Any:
18 self.trees = list(input)
19
20 width = len(self.trees[0])
21 height = len(self.trees)
22
23 return ((width - 1) * 2) + ((height - 1) * 2)
24
25
26class AssignmentOne(Assignment):
27 example_result = 21