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)
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]
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)
def get_constructions_positions(self): """ Returns the list of constructions Element Points.""" points = set() points.update(self._find_all(Element('CONSTRUCTION'))) return list(points)
def get_bullets_positions(self): """ Return the list of points for bullets.""" points = set() points.update(self._find_all(Element('BULLET'))) return list(points)
def get_at(self, x, y): """ Return an Element object at coordinates x,y.""" return Element(self._string[self._xy2strpos(x, y)])
def get_wall_positions(self): """Returns the set of undestroyable walls""" points = set() points.update(self._find_all(Element('BATTLE_WALL'))) return list(points)