diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-10-13 17:45:44 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-10-13 17:45:44 +0700 |
commit | e2149b18c27f536ea823ffe1a925ac483cafe3ec (patch) | |
tree | a943cf4e16ce009c4eea1ef5a18ddf77958209f2 /brutalmaze | |
parent | 7d346a219acb2f3f64d922c3711d7be491ff7fdb (diff) | |
download | brutalmaze-e2149b18c27f536ea823ffe1a925ac483cafe3ec.tar.gz |
Remove debugging print and improve style 0.8.28
Diffstat (limited to 'brutalmaze')
-rw-r--r-- | brutalmaze/game.py | 2 | ||||
-rw-r--r-- | brutalmaze/maze.py | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/brutalmaze/game.py b/brutalmaze/game.py index d6f470e..e8a8b20 100644 --- a/brutalmaze/game.py +++ b/brutalmaze/game.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Brutal Maze. If not, see <https://www.gnu.org/licenses/>. -__version__ = '0.8.27' +__version__ = '0.8.28' import re from argparse import ArgumentParser, FileType, RawTextHelpFormatter diff --git a/brutalmaze/maze.py b/brutalmaze/maze.py index 691f1ed..423b89a 100644 --- a/brutalmaze/maze.py +++ b/brutalmaze/maze.py @@ -139,9 +139,8 @@ class Maze: room, visited = [(MIDDLE, MIDDLE)], set() while room: bit = room.pop() - print(bit) - if not self.isdisplayed(*bit): break if bit not in visited: + if not self.isdisplayed(*bit): break visited.add(bit) for x, y in around(*bit): if self.map[x][y] == EMPTY: room.append((x, y)) @@ -480,10 +479,8 @@ class Maze: queue, visited = deque([(self.destx, self.desty)]), set() while queue: x, y = queue.pop() - if (x, y) not in visited: - visited.add((x, y)) - else: - continue + if (x, y) in visited: continue + visited.add((x, y)) dx, dy = MIDDLE - x, MIDDLE - y if dx**2 + dy**2 <= 2: # Succeeded on finding a path |