summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--4.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/4.py b/4.py
index 0d44156..1373ca3 100644
--- a/4.py
+++ b/4.py
@@ -26,12 +26,15 @@ class Board:
def call(self, num: int) -> None:
if num not in self.nums: return
pos: int = self.cells.index(num)
- self.col_hits[pos % self.width] += 1
- self.row_hits[pos // self.width] += 1
+ x: int = pos % self.width
+ y: int = pos // self.width
+ self.col_hits[x] += 1
+ self.row_hits[y] += 1
self.unmarked_sum -= num
self.has_bingo = (
- any(hits == self.height for hits in self.col_hits) or
- any(hits == self.width for hits in self.row_hits)
+ self.has_bingo or
+ self.col_hits[x] == self.height or
+ self.row_hits[y] == self.width
)
@staticmethod
def from_string(s: str) -> 'Board':