示例#1
0
 def get_barriers(self):
     """ Return the list of barriers Points."""
     points = set()
     points.update(
         self._find_all(Element('MEATCHOPPER'), Element('WALL'),
                        Element('WALL_DESTROYABLE'),
                        Element('OTHER_BOMBERMAN'),
                        Element('OTHER_BOMB_BOMBERMAN'),
                        Element('BOMB_TIMER_1'), Element('BOMB_TIMER_2'),
                        Element('BOMB_TIMER_3'), Element('BOMB_TIMER_4'),
                        Element('BOMB_TIMER_5')))
     return list(points)
示例#2
0
 def get_the_nearest_bomberman(self):
     all_bombermen = self._find_all(Element('OTHER_BOMBERMAN'))
     my_point = self.get_bomberman()
     mx, my = my_point.get_x(), my_point.get_y()
     print(mx, my)
     d = {}
     for i in all_bombermen:
         x, y = i.get_x(), i.get_y()
         d[i] = int(sqrt((mx - x) ** 2 + (my - y) ** 2))
     return min(d, key=d.get)
示例#3
0
 def get_bombs(self):
     """ Return the list of bombs Points."""
     points = set()
     points.update(
         self._find_all(Element('BOMB_BOMBERMAN'), Element('BOMB_TIMER_1'),
                        Element('BOMB_TIMER_2'), Element('BOMB_TIMER_5'),
                        Element('BOMB_TIMER_4'), Element('BOMB_TIMER_3')))
     return list(points)
示例#4
0
 def get_element_at(self, point):
     """ Return an Element object at coordinates x,y."""
     return Element(self._string[self._xy2strpos(point.get_x(),
                                                 point.get_y())])
示例#5
0
 def get_blasts(self):
     return self._find_all(Element('BOOM'))
示例#6
0
 def get_metchoppers(self):
     return self._find_all(Element('MEATCHOPPER'))
示例#7
0
 def get_destroyable_walls(self):
     return self._find_all(Element('WALL_DESTROYABLE'))
示例#8
0
 def am_i_dead(self):
     return self.find_first_element(Element('DEAD_BOMBERMAN')) is not None
示例#9
0
 def get_walls(self):
     return self._find_all(Element('WALL'))
示例#10
0
 def get_other_bombermans(self):
     return self._find_all(Element('OTHER_BOMBERMAN'),
                           Element('OTHER_DEAD_BOMBERMAN'),
                           Element('OTHER_BOMB_BOMBERMAN'))
示例#11
0
 def get_bomberman(self):
     return self.find_first_element(Element('BOMBERMAN'),
                                    Element('DEAD_BOMBERMAN'),
                                    Element('BOMB_BOMBERMAN'))
示例#12
0
 def get_fast_bombs(self, ind=2):
     """ Return the list of bombs Points."""
     points = set()
     el = [Element('BOMB_TIMER_{}'.format(i)) for i in range(1, ind)]
     points.update(self._find_all(*el))
     return list(points)
示例#13
0
 def is_free(self, point):
     if point.is_out_of_board(self._size):
         return False
     if self._find_all(Element('NONE'), Element('DEAD_MEATCHOPPER'), Element('OTHER_DEAD_BOMBERMAN')).__contains__(point):
         return True
     return False
示例#14
0
 def am_i_dead(self):
     return self._find_first(Element('DEAD_BOMBERMAN')).__contains__(
         element('DEAD_BOMBERMAN'))