summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2021-12-04 14:26:10 +0000
committerTomasz Kramkowski <tk@the-tk.com>2021-12-04 14:26:10 +0000
commitdd9578b2c39127674a17a9e13fbf1a728969e789 (patch)
treeb324afcd4fac0cda51f7ed351465bc18b7ef5e18
parent80b190c164cf08d83ba8efb91bfcf556f9cc71f1 (diff)
downloadaoc2021-dd9578b2c39127674a17a9e13fbf1a728969e789.tar.gz
aoc2021-dd9578b2c39127674a17a9e13fbf1a728969e789.tar.xz
aoc2021-dd9578b2c39127674a17a9e13fbf1a728969e789.zip
day 4: unpack pos
-rw-r--r--4.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/4.py b/4.py
index c75706c..5e60e52 100644
--- a/4.py
+++ b/4.py
@@ -18,12 +18,13 @@ class Board:
def call(self, num: int) -> None:
pos: tuple[int, int] | None = self.nums.pop(num, None)
if pos is None: return
- self.col_hits[pos[0]] -= 1
- self.row_hits[pos[1]] -= 1
+ x, y = pos
+ self.col_hits[x] -= 1
+ self.row_hits[y] -= 1
self.has_bingo = (
self.has_bingo or
- not self.col_hits[pos[0]] or
- not self.row_hits[pos[1]]
+ not self.col_hits[x] or
+ not self.row_hits[y]
)
@property
def unmarked_sum(self) -> int: