aoc2018/day15.py
2025-07-19 11:17:10 +02:00

59 lines
1.2 KiB
Python

from enum import Enum
from tools.aoc import AOCDay
from typing import Any
from tools.grid import Grid
class UnitType(int, Enum):
GOBLIN = 1
ELF = 2
class Unit:
def __init__(self, unit_type: UnitType):
self.unit_type = unit_type
self.hit_points = 300
self.attack_power = 3
class Day(AOCDay):
inputs = [
[
(27730, "input15_test1"),
(36334, "input15_test2"),
(39514, "input15_test3"),
(27755, "input15_test4"),
(28944, "input15_test5"),
(18740, "input15_test6"),
(None, "input15"),
],
[
(None, "input15"),
],
]
def parse_input(self) -> Grid:
grid = Grid.from_data(self.getInput())
for c in grid.getActiveCells():
if grid.get(c) not in "EG":
continue
if grid.get(c) == "E":
grid.set(c, Unit(UnitType.ELF))
else:
grid.set(c, Unit(UnitType.GOBLIN))
return grid
def part1(self) -> Any:
return ""
def part2(self) -> Any:
return ""
if __name__ == "__main__":
day = Day(2018, 15)
day.run(verbose=True)