blob: 21e18d25576b1d9b098ec3e393e1634d8e349ae0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
|