Return 404 on game event listing if the game not exists

This commit is contained in:
2020-11-08 14:24:13 -03:00
parent 92268557b7
commit 7ca3f9e189
2 changed files with 13 additions and 10 deletions

View File

@@ -72,24 +72,21 @@ class Minesweeper:
def is_mine(self, row, col):
""" Checks whether the given location have a mine """
try:
return self.board[row][col] == -1
except IndexError:
if not self.is_point_in_board(row, col):
return False
return self.board[row][col] == -1
def is_empty(self, row, col):
""" Checks whether the given location is empty """
try:
return self.board[row][col] == 0
except IndexError:
if not self.is_point_in_board(row, col):
return False
return self.board[row][col] == 0
def is_point(self, row, col):
""" Checks whether the given location have pontuation """
try:
return self.board[row][col] > 0
except IndexError:
if not self.is_point_in_board(row, col):
return False
return self.board[row][col] > 0
def is_point_in_board(self, row, col):
""" Checks whether the location is inside board """