day16 - no need dataclass -> 180ms/1m17s
This commit is contained in:
parent
f739d6cf74
commit
2966e26c44
7
day16.py
7
day16.py
@ -1,5 +1,4 @@
|
|||||||
from collections import deque
|
from collections import deque
|
||||||
from dataclasses import dataclass
|
|
||||||
from itertools import product
|
from itertools import product
|
||||||
from tools.aoc import AOCDay
|
from tools.aoc import AOCDay
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -12,10 +11,10 @@ class Valve:
|
|||||||
self.tunnels: set = set()
|
self.tunnels: set = set()
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Tunnel:
|
class Tunnel:
|
||||||
target: Valve
|
def __init__(self, target: Valve, length: int = 1):
|
||||||
length: int = 1
|
self.target: Valve = target
|
||||||
|
self.length: int = length
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Tunnel(target={self.target.name}, length={self.length})"
|
return f"Tunnel(target={self.target.name}, length={self.length})"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user