summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2021-12-06 08:25:51 +0000
committerTomasz Kramkowski <tk@the-tk.com>2021-12-06 08:49:58 +0000
commit29e2b30ab066b36762326c3315e0e02702d3c246 (patch)
tree573c1ef5b554c06a4fb1b85441e6923bd6ae4ada
parent36bd3e75b10a4cfa333815170044f54c41487ab5 (diff)
downloadaoc2021-29e2b30ab066b36762326c3315e0e02702d3c246.tar.gz
aoc2021-29e2b30ab066b36762326c3315e0e02702d3c246.tar.xz
aoc2021-29e2b30ab066b36762326c3315e0e02702d3c246.zip
day 4: shorter and cleaner
-rw-r--r--4.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/4.py b/4.py
index 1b396cb..9dee99d 100644
--- a/4.py
+++ b/4.py
@@ -25,9 +25,10 @@ boards = [board_from_string(board) for board in boards]
first: Win = Win(None, max(nums))
last: Win = Win(None, 0)
for i, board in enumerate(boards):
- row: int = min(max(row) for row in board)
- col: int = min(max(col) for col in zip(*board))
- win: Win = Win(i, min(row, col))
+ win: Win = Win(i, min(
+ min(max(row) for row in board),
+ min(max(col) for col in zip(*board))
+ ))
if win.round < first.round: first = win
if win.round > last.round: last = win