From 4e749b6fddca95d5df94b05fedffcd17dbdbdd9a Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Sun, 8 Dec 2024 11:51:21 +0100 Subject: [PATCH] day8 - use the tools, luke --- day08.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/day08.py b/day08.py index 6a6eaad..2b271d2 100644 --- a/day08.py +++ b/day08.py @@ -1,5 +1,6 @@ from itertools import combinations from tools.aoc import AOCDay +from tools.tools import minmax from typing import Any from tools.grid import Grid @@ -15,7 +16,7 @@ def get_antinode_count(grid: Grid, repeat: bool = False) -> int: antinodes |= antennas for pair in combinations(antennas, 2): - a, b = (pair[0], pair[1]) if pair[0] < pair[1] else (pair[1], pair[0]) + a, b = minmax(*pair) diff = b - a while grid.isWithinBoundaries(a - diff):