Exemplo n.º 1
0
 def get_other_tank_positions(self):
     """ Return the list of points for other tanks."""
     points = set()
     points.update(self._find_all(Element('OTHER_TANK_LEFT')))
     points.update(self._find_all(Element('OTHER_TANK_RIGHT')))
     points.update(self._find_all(Element('OTHER_TANK_UP')))
     points.update(self._find_all(Element('OTHER_TANK_DOWN')))
     return list(points)
Exemplo n.º 2
0
 def get_my_position(self):
     """ Return the point where your tank is."""
     points = set()
     points.update(self._find_all(Element('TANK_UP')))
     points.update(self._find_all(Element('TANK_DOWN')))
     points.update(self._find_all(Element('TANK_LEFT')))
     points.update(self._find_all(Element('TANK_RIGHT')))
     assert len(points) <= 1, "There should be only one tank"
     return list(points)[0]
Exemplo n.º 3
0
 def get_destroyed_constructions_positions(self):
     """ Returns the list of destroyed constructions Element Points."""
     points = set()
     points.update(self._find_all(Element('CONSTRUCTION_DESTROYED_DOWN')))
     points.update(self._find_all(Element('CONSTRUCTION_DESTROYED_UP')))
     points.update(self._find_all(Element('CONSTRUCTION_DESTROYED_LEFT')))
     points.update(self._find_all(Element('CONSTRUCTION_DESTROYED_RIGHT')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_DOWN_TWICE')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_UP_TWICE')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_LEFT_TWICE')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_RIGHT_TWICE')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_LEFT_RIGHT')))
     points.update(self._find_all(
         Element('CONSTRUCTION_DESTROYED_UP_DOWN')))
     points.update(self._find_all(
         Element('CONSTRUCTION_DESTROYED_UP_LEFT')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_RIGHT_UP')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_DOWN_LEFT')))
     points.update(
         self._find_all(Element('CONSTRUCTION_DESTROYED_DOWN_RIGHT')))
     return list(points)
Exemplo n.º 4
0
 def get_constructions_positions(self):
     """ Returns the list of constructions Element Points."""
     points = set()
     points.update(self._find_all(Element('CONSTRUCTION')))
     return list(points)
Exemplo n.º 5
0
 def get_bullets_positions(self):
     """ Return the list of points for bullets."""
     points = set()
     points.update(self._find_all(Element('BULLET')))
     return list(points)
Exemplo n.º 6
0
 def get_at(self, x, y):
     """ Return an Element object at coordinates x,y."""
     return Element(self._string[self._xy2strpos(x, y)])
Exemplo n.º 7
0
 def get_wall_positions(self):
     """Returns the set of undestroyable walls"""
     points = set()
     points.update(self._find_all(Element('BATTLE_WALL')))
     return list(points)