Simulator : Class, methods and attributes - PierreEtienneJ/SwarmZ GitHub Wiki
All the project classes are in files with the same name without uppercase
Vector
Attributes :
-x : float
-y : float
Methods :
-add(Vector)->Vector
-x_scal(float)->Vector
-norm_2(None)->float
-cap(None)->float
-distance(Vector)->float
-setCap(float)->None
-setNorm(float)->None
-copy()->Vector
Radar
Attributes :
-rays : numpy.ndarray
-nb_rays : int
-range : float
-deg_step : float (degrees)
-rad_step : float (radius)
Methods :
-update(list(Object), list(Drone))->None
Drone
Attributes :
-position : Vector
-next_position : Vector
-speed : Vector
-next_speed : Vector
-arrive : bool
-nearDrones : list(Drone)
-nearObjects : list(Object)
-goal : None or Object
-name : str
-color : tuple
Methods :
-set_next(None)->None
-update(flaot)->None
-setNextSpeed(Vector)->None
-getPosition(None)->Vector
-get_radius(None)->float
-setGoal(None)->None
-collision(None)->None
-setEnvironment(tuple)->None
-__updateRadar(None)->None
-fitness(None)->float
Object
Attributes :
-list_Points : list(Vector)
-center : Vector
-radius :float
Methods :
Environment:
Attributes :
-drones:list(Drone)
-objects:list(Object)
-goal:Vector or None
-nb_drones:int
-nb_objects:int
Methods :
-addObject(list(Vector))->None
-nearEnv(Vector, float)->tuple
-goal_has_def(None)->bool
-save(str)->None
-load(str)->None
.json :
-You can save the environment with the methode save and open with the methode load.
Simulator :
it is a class inherited from threadind.Thread
Attributes :
-environment: Environment
-eventDisplay: EventDisplay
Methods :
-update(float)->list(int)
-collision_Drone_Drone(int, int)->bool
-__collisionDroiteCercle(Vector,Vector, Vector, float)->bool
-collision_Drone_Objects(int, int)->bool
-droneGoal(int)->None
-run(None)->None
-stop(None)->None
Display :
Attributes :
-screen:pygame.Surface
-environment:environment.Environment
-eventDisplay:EventDisplay
-size:tuple
-background:tuple
-running:bool
-center:Vector
-radius:float
-zoom:float
-clock:pygame.Clock
-maintien_clique_gauche:bool
-position_souris_avant:Vector
-maintien_clique_droit:bool
-new_clique_Object:list(Vector)
-self.pos_souris:tuple
-displayRadar:bool
Methods :
-process_event(pygame.event)->None
-offset(tuple)->tuple
-offset_Point(Vector)->tuple
-inv_offset(tuple)->tuple
-inv_offsetPoint(tuple)->Vector
-update_screen(None)->None
-run(None)->None
EventDisplay :
Attributes :
-pause:bool
-stop:bool
-dt:float
-coefTime:float