Exemple #1
0
from simulation.simulation import Simulation
import pygame

#from experiments.flocking import parameters as p
# from experiments.aggregation import parameters as p
from experiments.covid import parameters as p
"""
Code for multi-agent simulation in PyGame with/without physical objects in the environment
"""

if __name__ == "__main__":
    pygame.init()
    sim = Simulation(num_agents=p.N_AGENTS,
                     screen_size=p.SCREEN,
                     swarm_type=p.SWARM,
                     iterations=p.FRAMES)
    sim.run()
Exemple #2
0
from simulation.simulation import Simulation
from display.screen import Screen
from brain.space import Volume
import numpy as np

screen_size = np.array([600, 600])
BACKGROUND_COLOR = (154, 154, 158)
RECORD_SETTINGS = ("gallery/imgs", "gallery/videos", "result", 24)
space = Volume(shape='rect', location=np.array([0, 0, 0]), size=screen_size)
sim = Simulation(
    space,
    Screen(screen_size, BACKGROUND_COLOR, "GENERIC SIMULATION NAME", space,
           RECORD_SETTINGS))

for i in range(1):
    sim.create_random_agent(14)

for i in range(300):
    sim.environment.generate_new_food()

sim.run(-1, 1, 0.5)