|
@ -11,10 +11,7 @@ import pathlib |
|
|
import sys |
|
|
import sys |
|
|
from typing import List, Tuple |
|
|
from typing import List, Tuple |
|
|
|
|
|
|
|
|
from dataclasses import dataclass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass |
|
|
|
|
|
class Location: |
|
|
class Location: |
|
|
horizontal = 0 |
|
|
horizontal = 0 |
|
|
depth = 0 |
|
|
depth = 0 |
|
@ -32,7 +29,6 @@ class Location: |
|
|
return self.horizontal * self.depth |
|
|
return self.horizontal * self.depth |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass |
|
|
|
|
|
class Puzzle1(Location): |
|
|
class Puzzle1(Location): |
|
|
def forward(self, distance: int) -> None: |
|
|
def forward(self, distance: int) -> None: |
|
|
self.horizontal += distance |
|
|
self.horizontal += distance |
|
@ -44,7 +40,6 @@ class Puzzle1(Location): |
|
|
self.depth += distance |
|
|
self.depth += distance |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass |
|
|
|
|
|
class Puzzle2(Location): |
|
|
class Puzzle2(Location): |
|
|
def forward(self, distance: int) -> None: |
|
|
def forward(self, distance: int) -> None: |
|
|
self.horizontal += distance |
|
|
self.horizontal += distance |
|
|