예제 #1
0
 def __init__(self, unrevealed, neighbors, rows, columns):
     self.unrevealed = unrevealed
     self.neighbors = neighbors
     self.rows = rows
     self.columns = columns
     self.flags = []
     self.servant = MineServant(self)
     self.exposed_field = self.neighbors.keys()
     self.possible_plays = []
     self.color_coding = {
         'flag': 'green',
         'bomb': 'red',
         'unrevealed': 'yellow',
         'zero': 'grey',
         'number': 'white'
     }
예제 #2
0
 def __init__(self, load_game=None):
     self.rows = 16
     self.columns = 30
     self.num_mines = 99
     if load_game is None:
         self.mine = Minesweeper(self.rows,
                                 self.columns,
                                 self.num_mines,
                                 gui=False)
     else:
         self.mine = Minesweeper.load_state(load_game)
     self.servant = MineServant(self.mine)
     self.exposed_indices = self.mine.exposed_field
     # Move these to self.exposed_field
     self.newly_exposed = []
     # Add block indices to here as they're revealed
     self.unchecked_blocks = []
     # Blocks scheduled to be removed after some processes for loops
     self.blocks_to_remove = set([])
     self.flags_planted = 0
     # Lose/win status. Both start as false naturally
     self.lose = False
     self.win = False
     self.semi_solver = None