Skip to content
Snippets Groups Projects
Commit fd7657e4 authored by Dahmane Lynda's avatar Dahmane Lynda
Browse files

Tp5

parent 33c98436
No related branches found
No related tags found
No related merge requests found
......@@ -218,25 +218,21 @@ class Minesweeper():
GameState.losing
"""
Cell=self.get_cell(x,y)
cell=self.grid[x][y]
cell.reveal()
if Cell.is_bomb:
self.state=GameState.losing
else:
Cell.is_revealed=True
if Cell.nbomb_in_neighborhood==0:
neighbor =self.get_neighbors(x,y)
for neighbor in neighbors:
elif Cell.nbomb_in_neighborhood==0:
for (xn,yn) in neighborhood(x,y, self.width, self.height):
if not self.grid[yn][xn].is_revealed:
self.reveal_all_cells_from(xn, yn)
if not neighbor.is_revealed:
self.reveal_all_Cells_from(neighbor.x,neighbor.y)
if self.all_Cells_are_revealed_or_bomb():
self.state=GameState.winning
if self.all_cells_are_revealed_or_bomb() :
self.state=GameState.winning
if (__name__ == '__main__'):
import apl1test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment