Skip to content

Commit

Permalink
refactor: second solution for 2024/3 to use dataclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
hectcastro committed Dec 3, 2024
1 parent 3256b4d commit 43fb110
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions 2024/3/2.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import fileinput
import re
from collections import namedtuple
from dataclasses import dataclass
from fileinput import FileInput

MulInstruction = namedtuple("MulInstruction", ["pos", "x", "y"])
DoInstruction = namedtuple("DoInstruction", ["pos"])
DontInstruction = namedtuple("DontInstruction", ["pos"])

@dataclass
class MulInstruction:
pos: int
x: int
y: int


@dataclass
class DoInstruction:
pos: int


@dataclass
class DontInstruction:
pos: int


def handler(raw_instructions: FileInput) -> int:
Expand Down

0 comments on commit 43fb110

Please sign in to comment.