def __init_enemy_bot(self): if self.__big_enemy_bot is not None: self.__big_enemy_poly = Poly().initFromCircle( (-1000, -1000), self.__big_enemy_bot["getRayon"] + self.__our_bot["getRayon"] + MARGE_PASSAGE_PATH, POINTS_PAR_CERCLE) self.__ng.add_dynamic_obstacle(self.__big_enemy_poly) if self.__small_enemy_bot is not None: self.__small_enemy_poly = Poly().initFromCircle( (-1000, -1000), self.__small_enemy_bot["getRayon"] + self.__our_bot["getRayon"] + MARGE_PASSAGE_PATH, POINTS_PAR_CERCLE) self.__ng.add_dynamic_obstacle(self.__small_enemy_poly) self.__update_enemy_bot()
def __init_allied_bot(self): if self.__our_bot_count == 2: self.__other_bot_poly = Poly().initFromCircle( self.__other_bot["getPosition"], self.__other_bot["getRayon"] + self.__our_bot["getRayon"] + MARGE_PASSAGE_PATH, POINTS_PAR_CERCLE) self.__ng.add_dynamic_obstacle(self.__other_bot_poly)
def xml_to_circle(xml_circle): x, y, r, n = int(xml_circle.getAttribute("x")), int( xml_circle.getAttribute("y")), int( xml_circle.getAttribute("rayon")), int( xml_circle.getAttribute("n")) poly = Poly().initFromCircle((x, y), r, n) return poly
def draw(self): '''Draw the funnel.''' return Poly(prev_position=self.prev_position, prev_depth=self.prev_depth, prev_output_dim=self.prev_output_dim, curr_position=self.curr_position, curr_depth=self.curr_depth, curr_output_dim=self.curr_output_dim, color=self.color).draw()
def xml_to_carre(xml_carre): x, y, w = int(xml_carre.getAttribute("x")), int( xml_carre.getAttribute("y")), int(xml_carre.getAttribute("width")) poly = Poly().initFromCarre((x, y), w, True) return poly
def xml_to_polygon(xml_poly): poly = Poly(((int(vertex.getAttribute("x")), int(vertex.getAttribute("y"))) for vertex in xml_poly.getElementsByTagName("vertex"))) return poly