diff options
-rw-r--r-- | 4.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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': |