def load_world(files, ia, sa): names = files.split() if len(names) > 1: world = World.load_map(names[0]) world.load_agents(names[1]) else: world = World.from_file(names[0], load_agents=True) world.clear_agents() for i in range(1, ia + 1): world.add_agent(agents.PathfindingIntruder) for s in range(1, sa + 1): world.add_agent(agents.CameraGuard) for s in range(sa, 5): world.add_agent(agents.PatrollingGuard) return world
from gui import renderer from simulation.world import World from simulation.environment import MapGenerator from ai import agents if __name__ == '__main__': i = input('Load save? ') # load from file if i: names = i.split() if len(names) > 1: world = World.load_map(names[0]) world.load_agents(names[1]) else: world = World.from_file(names[0], load_agents=True) # or build a new map else: m = MapGenerator.random(size=(51, 51)) world = World(m) world.add_agent(agents.CameraGuard) world.add_agent(agents.CameraGuard) world.add_agent(agents.CameraGuard) world.add_agent(agents.CameraGuard) world.add_agent(agents.CameraGuard) world.add_agent(agents.PathfindingIntruder) world.add_agent(agents.PathfindingIntruder) # initialise the world