# -*- 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