Skip to content

Commit

Permalink
fixed exploded mines display
Browse files Browse the repository at this point in the history
  • Loading branch information
GalaX1us committed Oct 20, 2022
1 parent 6d5d24a commit 94f6ad3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AI.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def gen_prob_map(self):

if y - use_size >= 0:
endpoints.append(((y - use_size, x), (y, x)))
if y + use_size <= 9:
if y + use_size < NB_TILE:
endpoints.append(((y, x), (y + use_size, x)))
if x - use_size >= 0:
endpoints.append(((y, x - use_size), (y, x)))
if x + use_size <= 9:
if x + use_size < NB_TILE:
endpoints.append(((y, x), (y, x + use_size)))

for (start_y, start_x), (end_y, end_x) in endpoints:
Expand Down
Empty file removed client.py
Empty file.
2 changes: 2 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ def main_loop(game:Game, AI=0):

if game.over:
#display a game over message
if game.current_player.hp==0:
game.change_player()
draw_text(f"{game.current_player.name} Won !", (1/4)*WIDTH-35, 0,size=80, color=GREEN)
else:
#display current playe name and health points
Expand Down
1 change: 1 addition & 0 deletions player.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def getting_shot(self,x,y):
sunk_idx = []

if idx in self.board.list_tiles_mines:
self.add_opponent_move(idx,Move.EXPLOSION)
return Move.EXPLOSION, sunk_idx

for ship in self.board.ships:
Expand Down
Empty file removed server.py
Empty file.

0 comments on commit 94f6ad3

Please sign in to comment.