示例#1
0
 def try_to_explode(self, gem):
     '''If the gem is a crash gem, try to explode it.'''
     for neighbor in gem.get_neighbors():
         if not neighbor is None and neighbor.color == gem.color:
             if not neighbor.active and not neighbor.counter > 0:
                 exploded = self.explode(gem)
                 return exploded
     return 0
示例#2
0
 def try_to_explode(self, gem):
     '''If the gem is a crash gem, try to explode it.'''
     for neighbor in gem.get_neighbors():
         if not neighbor is None and neighbor.color == gem.color:
             if not neighbor.active and not neighbor.counter > 0:
                 exploded = self.explode(gem)
                 return exploded
     return 0
示例#3
0
 def explode(self, gem):
     '''Blows up the gem and nearby gems.'''
     self.remove(gem)
     neighbors = gem.get_neighbors()
     exploded = 0
     for neighbor in neighbors:
         if not neighbor is None and neighbor.color == gem.color:
             if not neighbor.active and not neighbor.counter > 0:
                 exploded += 1 + self.explode(neighbor)
     return exploded
示例#4
0
 def explode(self, gem):
     '''Blows up the gem and nearby gems.'''
     self.remove(gem)
     neighbors = gem.get_neighbors()
     exploded = 0
     for neighbor in neighbors:
         if not neighbor is None and neighbor.color == gem.color:
             if not neighbor.active and not neighbor.counter > 0:
                 exploded += 1 + self.explode(neighbor)
     return exploded