diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-12 09:11:07 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-12 09:11:07 +0200 |
commit | f3a475d4744c4c2b631c24f4875b5c845baa1f93 (patch) | |
tree | dc2e26f4bec16683d045fa823c428279a5ed6b01 /board | |
parent | af0c8ae0d05d638ac5050157a638e85900c2484f (diff) |
Fixing bug where 1x1 wont uncover.
Diffstat (limited to 'board')
-rw-r--r-- | board/board.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/board/board.py b/board/board.py index 3b5cd77..9666bad 100644 --- a/board/board.py +++ b/board/board.py @@ -60,6 +60,8 @@ class Board(): def collect_area(self, x, y, area=set()): + if not area: + area.add((x,y)) to_test = [] for dx, dy in ( (0,-1), (-1,0), (1,0), (0,1) ): if self.invalid_coordinates(x+dx, y+dy): @@ -68,7 +70,6 @@ class Board(): to_test.append((x+dx, y+dy)) area.add((x+dx, y+dy)) for tx, ty in to_test: - area.add((x,y)) area=area.union(self.collect_area(tx, ty, area)) return area |