def __init__(self, config): Cloud.__init__(self, "Axeda", config) if not config.get("name"): assert (False) if not config.get("api_key"): assert (False) if not config.get("asset"): assert (False) if not config.get("model"): assert (False) self.config = config self.api_key = config["api_key"] # Service Requires SSL self.ssl = config.get('ssl') self.debug = config["debug"] if config.get('debug') else False self.name_space = None # Always use v1 host = 'https://windriver.api.mashery.com/' self.url_prefix = host + config['name'] + '/services/v1/rest/'
def create_cloud(ai_settings, screen, clouds, cloud_number, row_number): cloud = Cloud(ai_settings, screen) cloud_width = cloud.rect.width cloud.x = cloud_width + 2 * cloud_width * cloud_number cloud.rect.x = cloud.x cloud.rect.y = cloud.rect.height + 2 * cloud.rect.height * row_number clouds.add(cloud)
def setup(): test_thing = Thing(id='01', token='aaaa', name='aaaa') test_cloud = Cloud() assert test_cloud.connect(arguments="'wss' 'ws.knot.cloud' 443") return test_thing, test_cloud
def cloud_pattern(pattern_num): model = { 0 : 'MODEL 1', 1 : 'MODEL 2', 2 : 'MODEL 3', 3 : 'MODEL 4', 4 : 'MODEL 5', 5 : 'MODEL 6', 6 : 'MODEL 7', 7 : 'MODEL 8', 8 : 'MODEL 9', 9 : 'MODEL 10' } cloud_data_file = open('resource\\txt\\cloud_data.txt', 'r') cloud_data = json.load(cloud_data_file) cloud_data_file.close() clouds = [] for name in cloud_data[model[pattern_num]]: cloud = Cloud() cloud.name = name cloud.x = cloud_data[model[pattern_num]][name]['x'] cloud.y = cloud_data[model[pattern_num]][name]['y'] clouds.append(cloud) return clouds
def init(data): user = User() user.create_tasks(data=data) cloud = Cloud() cloud.create_vms(data=data) return user, cloud
def __init__(self, config): Cloud.__init__(self, "Axeda", config) if self.get('name') == None: assert(False) if self.get('username') == None: assert(False) if self.get('password') == None: assert(False) if not self.get("asset"): assert(False) if not self.get("model"): assert(False) self.config = config self.username = self.get('username') self.password = self.get('password') self.timeout = self.get('timeout') self.session_id = None if self.get('ssl') != None: self.ssl = self.get('ssl') else: self.ssl = None self.debug = config["debug"] if config.get('debug') else False # Use json or xml? if self.get('json') == None: self.json = True else: self.json = self.get('json') if self.ssl == True: self.v1_url_prefix = 'https' self.v2_url_prefix = 'https' else: self.v1_url_prefix = 'http' self.v2_url_prefix = 'http' self.v1_url_prefix += '://' + config['name'] + '/services/v1/rest/' self.v2_url_prefix += '://' + config['name'] + '/services/v2/rest/' if not self.json: self.name_space = 'http://type.v1.webservices.sl.axeda.com' ElementTree.register_namespace('', self.name_space) #ElementTree.register_namespace('xsi', "http://www.w3.org/2001/XMLSchema-instance") else: self.name_space = None
def __init__(self): self.logger = logging.getLogger("DNSWatch.AWS") metadata = { "url": "http://169.254.169.254/latest/meta-data", "headers": "" } self.cloud = Cloud(metadata)
def playing(time): global run, left, right for event in pygame.event.get(): if event.type == pygame.QUIT: run = False if main.check_end() and (event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN): update_results() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: left = True elif event.key == pygame.K_RIGHT: right = True elif event.type == pygame.KEYUP: left = False right = False elif event.type == pygame.MOUSEBUTTONDOWN: if pygame.mouse.get_pos()[0] < main.get_posit()[0] + 40: main.left() elif pygame.mouse.get_pos()[0] > main.get_posit()[0] + 40: main.right() if main.check_end(): the_end(time, result.get_result()) else: Cloud().change_h() the_game()
def __init__(self): self.logger = logging.getLogger("DNSWatch.GCE") metadata = { "url": "http://169.254.169.254/computeMetadata/v1/instance", "headers": { "Metadata-Flavor": "Google" } } self.cloud = Cloud(metadata)
def add_items(): """ Initialize all items to be added to the model""" # create all instances of goombas model.items.append(Goomba(model, 700, 300, -0.1, 0)) model.items.append(Goomba(model, 800, 300, -0.1, 0)) model.items.append(Goomba(model, 1000, 300, -0.1, 0)) model.items.append(Goomba(model, 1300, 300, -0.1, 0)) model.items.append(Goomba(model, 1500, 300, -0.1, 0)) model.items.append(Goomba(model, 1700, 300, -0.1, 0)) model.items.append(Goomba(model, 2800, 300, -0.1, 0)) model.items.append(Goomba(model, 3000, 300, -0.1, 0)) # create all instances of pipes model.items.append(Pipe(model, 800, 425, height=125)) model.items.append(Pipe(model, 2000, 425, height=125)) # create all instances of bricks in the air model.items.append(Air_Bricks(model, 550, 450)) model.items.append(Air_Bricks(model, 1000, 450)) model.items.append(Air_Bricks(model, 1400, 450)) model.items.append(Air_Bricks(model, 2600, 450)) # create the flag and castle model.items.append(Flag(model, length - 275, 250)) model.items.append(Castle(model, length - 200, 350)) # add clouds to display for n in range(1, length, 400): model.items.append(Cloud(x=n, y=random.randint(50, 250)))
def _create_cloud(self): """Create clouds in random position (x, y).""" number_clouds = int( self.settings.clouds_total) # Make sure it's an integer. for number in range(number_clouds): # Generate clouds. cloud = Cloud(self) # Create Cloud instance self.clouds.add(cloud) # Add cloud to clouds sprote.
def download(path): path = Cloud.path_format(path) cloud.cache_files(path) if path not in cloud.files: return 'File not exist' return redirect(cloud.download(path))
def publish_data(self, data): logger.debug("Sub: Publishing the data to upstream!") dweet = Dweet.get_instance() if dweet: dweet.dweet(data) cloud = Cloud.get_instance() if cloud: cloud.send_to_cloud(data)
def generate_clouds(self): if self.CLOUDS: return self.CLOUDS if self.CLOUDS == None: self.CLOUDS = [] for n in self.__cloudnames: c = Cloud(n) self.CLOUDS.append(c) return self.CLOUDS
class GCE: def __init__(self): self.logger = logging.getLogger("DNSWatch.GCE") metadata = { "url": "http://169.254.169.254/computeMetadata/v1/instance", "headers": { "Metadata-Flavor": "Google" } } self.cloud = Cloud(metadata) def is_inside(self): return self.cloud.is_inside() def get_private_ip(self): return self.cloud.get_data("network-interfaces/0/ip").text def get_public_ip(self): return self.cloud.get_data("network-interfaces/0/access-configs/0/external-ip").text
class AWS: def __init__(self): self.logger = logging.getLogger("DNSWatch.AWS") metadata = { "url": "http://169.254.169.254/latest/meta-data", "headers": "" } self.cloud = Cloud(metadata) def is_inside(self): return self.cloud.is_inside() def get_private_ip(self): return self.cloud.get_data("local-ipv4").text def get_public_ip(self): return self.cloud.get_data("public-ipv4").text
def _check_clouds(self): """ Manage clouds on screen. """ if self.cloud_time_elapsed > self.settings.cloud_frequency and len( self.clouds) < self.settings.cloud_qty: self.cloud_time_elapsed = 0 new_cloud = Cloud(self) self.clouds.add(new_cloud) self._check_cloud_edges()
def choice(time): global doodles, doodles_jump screen.fill(BLUE) draw_cloud() for i in range(len(doodles)): if int(time % 2) == 0: draw_doodle(doodles[i], i) else: draw_doodle(doodles_jump[i], i) Cloud().change_h()
def make_cloud(self, pos="random", size="random", life="random", max_speed=""): if size == "random": size = random.randint(5, 100) radius = int(size / 2) if pos == "random": pos = (random.randint(0, self.screen.get_width()), random.randint(0, self.screen.get_height())) cloud = Cloud(self, pos, size) if life != "random": life = life if max_speed != "": cloud.max_speed = max_speed self.clouds.add(cloud)
def __init__(self, urls): """ urls: A list of string urls to scrape and generate a single word cloud image. """ self.urls = urls self.visible_text = '' for i, url in enumerate(urls): print 'Fetching url contents %s of %s' % (str(i+1), str(len(urls))) html = urllib2.urlopen(url).read() soup = BeautifulSoup(html, 'html5lib') [s.extract() for s in soup(['style', 'script', '[document]', 'head', 'title', 'iframe'])] self.visible_text = soup.getText().encode('utf-8', 'ignore') cloud = Cloud(self.visible_text) cloud.generate_cloud() print '\nComplete'
def add_clouds(self): for x in self.cloudS1: small = Cloud(self.screen, "small", 64, 48) small.rect.x = x * 32 small.rect.y = 96 self.clouds.append(small) for x in self.cloudS2: small = Cloud(self.screen, "small", 64, 48) small.rect.x = x * 32 small.rect.y = 64 self.clouds.append(small) for x in self.cloudM: small = Cloud(self.screen, "medium", 96, 48) small.rect.x = x * 32 small.rect.y = 64 self.clouds.append(small) for x in self.cloudL: small = Cloud(self.screen, "large", 128, 48) small.rect.x = x * 32 small.rect.y = 96 self.clouds.append(small)
def create_clouds(ai_settings, screen, ship, clouds): """Создание облаков""" cloud = Cloud(ai_settings, screen) number_clouds_x = get_number_clouds_x(ai_settings, cloud.rect.width) cloud_width = cloud.rect.width number_rows = get_number_rows(ai_settings, ship.rect.height, cloud.rect.height) # Создание рядов облаков for row_number in range(number_rows): for cloud_number in range(number_clouds_x): create_cloud(ai_settings, screen, clouds, cloud_number, row_number)
def start_loop(self): # Run until the user asks to quit running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False if event.type == KEYDOWN: if event.type == K_ESCAPE: running = False elif event.type == QUIT: running = False elif event.type == self.game_event: new_enemy = Enemy(self.screen_width, self.screen_height) self.enemy.add(new_enemy) self.all_sprites.add(new_enemy) elif event.type == self.cloud_event: new_cloud = Cloud(self.screen_width, self.screen_height) self.cloud.add(new_cloud) self.all_sprites.add(new_cloud) pressed_keys = pygame.key.get_pressed() self.player.update(pressed_keys) self.enemy.update() self.cloud.update() self.screen.fill(self.color_palette[int((self.counter / 500) % 5)]) # Draw one surface on top of another for sprite in self.all_sprites: self.screen.blit(sprite.surface, sprite.rect) self.score.increment_value(jump=0.1) score = self.score.font.render( "Score: {0}".format(int(self.score.get_value())), True, (0, 0, 0)) high_score = self.score.font.render( "High Score: {0}".format(int(self.high_score.get_value())), True, (100, 0, 0)) self.screen.blit(score, (20, 20)) self.screen.blit(high_score, (800, 20)) # Check for collision if pygame.sprite.spritecollideany(self.player, self.enemy): self.player.kill() running = False pygame.display.flip() # to ensure the game maintains a frame rate of 30 self.clock.tick(30) self.counter += 1 # Store the score if high score made self.high_score.write(self.score.get_value()) pygame.quit()
def __init__(self): self.const = constant() self.root = Tk() self.fr = Frame(self.root) self.root.geometry( str(self.const['field_width']) + 'x' + str(self.const['field_height'])) self.canvas = Canvas(self.root, bg='skyblue') self.canvas.pack(fill=BOTH, expand=1) self.field = Field(self.canvas) self.field_list = self.field.field_model() self.is_field = 0 self.worms = [] self.guns = [] self.clouds = [] self.bullets = [] self.boom = [] self.field.field_visual() self.wind = rnd(-3, 3) self.turn = 0 self.turn_end = 0 self.worms_number = self.const['worms_number'] self.is_shot = 0 self.event = 0 self.canvas.bind('<p>', self.is_turn_end) self.canvas.bind('<ButtonRelease-1>', self.shot_start) if len(self.const) < len(self.field.start_position): print('too many worms for this map') else: for num in range(self.const['worms_number']): self.worms.append( Worm( self.field.start_position[num][0], self.field.start_position[num][1], num, self.canvas, self, )) for num in range(self.worms_number): self.worms[num].player_number = num + 1 for num in range(self.const['clouds_number']): self.clouds.append(Cloud(num, self.canvas)) self.shooting_processing() self.walking_processing() self.choose_weapon()
def enter(): global background, player, mob1s, blocks, pipes, stairs, traproad, mush, muscle, cloud, mob2, mob3 background = Background() player = Player() mob1s = create_mobs() blocks = create_blocks() pipes = create_pipes() stairs = create_stairs() traproad = Traproad() mush = Mushroom() muscle = Muscleman() cloud = Cloud() mob2 = Monster2() mob3 = Monster3() player.set_background(background)
def __init__(self, width=64, height=64): self.width = width self.height = height self.frame = 0 self.starttime = time.time() self.im = Image.new("RGBA", (width,height), "black") self.im_draw = ImageDraw.Draw(self.im) self.bg = Image.open("images/bg_normal_big.png") self.bgofs = 0 self.font = ImageFont.truetype("fonts/spincycle.ttf", 18) self.font_sm = ImageFont.truetype("fonts/pf_tempesta_seven.ttf", 8) self.clouds = Cloud.create(20) self.weather = Weather() self.rain = Rain() self.conditions = ""
def criar_obstatuclos(counter, cacti, pteras, clouds): last_obstacle = context.last_obstacle if len(clouds) < 5 and random.randrange(0, 300) == 10: Cloud(context.width, random.randrange(height / 5, height / 2)) for l in last_obstacle: if l.rect.right > context.width * 0.7: return if len(cacti) < 2: r = 10 if len(cacti) > 0: r = random.randrange(0, 60) if r == 10: last_obstacle.add(Cactus(context, 30, 40)) return elif r == 30: last_obstacle.add(Cactus(context, 70, 50)) return if len(pteras) == 0 and random.randrange(0, 100) == 10 and counter > 500: last_obstacle.add(Ptera(context, 46, 40))
def process_events(self): running = True for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: running = False elif event.key == pygame.K_SPACE: self.player.shoot(self.all_sprites, self.shoots) elif event.type == pygame.QUIT: running = False # Add a new enemy? elif event.type == ADDENEMY: # Create the new enemy and add it to sprite groups enemy = Enemy() self.enemies.add(enemy) self.all_sprites.add(enemy) # Add a new cloud? elif event.type == ADDCLOUD: # Create the new cloud and add it to sprite groups cloud = Cloud() self.clouds.add(cloud) self.all_sprites.add(cloud) return running
def start_your_engines(): global settings, mycloud load_config() mycloud = Cloud() mycloud.auth(settings["username"], settings["password"])
import logging # Fix logging faliure issue for handler in logging.root.handlers[:]: logging.root.removeHandler(handler) # Initialise custom logging format FORMAT = "%(relativeCreated)6d %(levelname)-8s %(name)s %(process)d %(message)s" logging.basicConfig(format=FORMAT, level=logging.INFO) logger = logging.getLogger(__name__) settings = Settings() labels = Labels() camera = Camera() thermal = ThermalCamera() cloud = Cloud() classify = Classify() data = Data() control = Control() class OnionBot(object): """Main OnionBot script""" def __init__(self): self.quit_event = Event() # Launch multiprocessing threads logger.info("Launching worker threads...") camera.launch()
} #the player image PLAYER = pygame.image.load('player.png') #the position of the player [x,y] playerPos = [0, 0] #game dimensions TILESIZE = 20 MAPWIDTH = 50 MAPHEIGHT = 30 tilemap = [[DIRT for w in range(MAPWIDTH)] for h in range(MAPHEIGHT)] clouds = [] for i in range(numcloud): clouds.append( Cloud(random.randint(-200, -50), random.randint(0, MAPHEIGHT * TILESIZE), random.randint(1, 3))) #set up the display pygame.init() DISPLAYSURF = pygame.display.set_mode( (MAPWIDTH * TILESIZE, MAPHEIGHT * TILESIZE + 50)) #add a font for our inventory INVFONT = pygame.font.Font('FreeSansBold.ttf', 18) #loop through each row for rw in range(MAPHEIGHT): #loop through each column in that row for cl in range(MAPWIDTH): #pick a random number between 0 and 100 randomNumber = random.randint(0, 100)
game_over_font.set_bold(True) FPS = 60 screen = Screen() screen.init_screen(800, 600) gameDisplay = pygame.display.set_mode((screen.width, screen.height)) pygame.display.set_caption('Crappy Bird') pygame.display.set_icon(icon) clock = pygame.time.Clock() gameExit = False game_over = False #Create Entities bird = Bird() obstacle = Obstacle() cloud = Cloud() bird = init_bird(bird, screen) obstacle = init_obstacle(obstacle, screen) cloud = init_cloud(cloud, screen) gravity = 2 lift = 0 # Game Screen Loop while not gameExit: # Player Actions for event in pygame.event.get(): if event.type == pygame.QUIT: gameExit = True
def generate_map(self, settings, screen, objects, background, mario): mario.x = 100 mario.y = settings.ground_level - mario.height mario.rect.x = mario.x mario.rect.y = mario.y self.generate_ground(settings, screen, objects) background.add( Hill(settings, screen, 0, settings.ground_level - settings.large_hill_height, 2)) background.add( Cloud(settings, screen, settings.brick_lenth * 9, settings.brick_lenth * 3, 1)) background.add( Bush(settings, screen, settings.brick_lenth * 12, settings.ground_level - settings.brick_lenth, 3)) background.add( Hill(settings, screen, settings.brick_lenth * 16, settings.ground_level - settings.brick_lenth - 2, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 16, settings.ground_level - settings.brick_lenth * 4, 1)) background.add( Cloud(settings, screen, settings.brick_lenth * 20, settings.ground_level - settings.brick_lenth * 15, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 22, settings.ground_level - settings.brick_lenth * 8, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 20, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 21, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 22, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 23, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 24, settings.ground_level - settings.brick_lenth * 4, 3)) background.add( Bush(settings, screen, settings.brick_lenth * 23.5, settings.ground_level - settings.brick_lenth, 1)) objects.add( Pipe(settings, screen, settings.brick_lenth * 29, settings.ground_level - settings.brick_lenth * 2, 1)) objects.add( Pipe(settings, screen, settings.brick_lenth * 39, settings.ground_level - settings.brick_lenth * 3, 2)) objects.add( Pipe(settings, screen, settings.brick_lenth * 47, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Pipe(settings, screen, settings.brick_lenth * 58, settings.ground_level - settings.brick_lenth * 4, 3)) background.add( Cloud(settings, screen, settings.brick_lenth * 28, settings.ground_level - settings.brick_lenth * 12, 3)) background.add( Cloud(settings, screen, settings.brick_lenth * 37, settings.ground_level - settings.brick_lenth * 15, 2)) background.add( Bush(settings, screen, settings.brick_lenth * 41.5, settings.ground_level - settings.brick_lenth, 3)) background.add( Hill(settings, screen, settings.brick_lenth * 49, settings.ground_level - settings.large_hill_height - 2, 2)) background.add( Cloud(settings, screen, settings.brick_lenth * 57, settings.ground_level - settings.brick_lenth * 15, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 65, settings.ground_level - settings.brick_lenth * 5, 1)) background.add( Bush(settings, screen, settings.brick_lenth * 60.5, settings.ground_level - settings.brick_lenth, 3)) background.add( Hill(settings, screen, settings.brick_lenth * 65, settings.ground_level - settings.small_hill_height, 1)) background.add( Cloud(settings, screen, settings.brick_lenth * 68, settings.ground_level - settings.brick_lenth * 15, 1)) background.add( Bush(settings, screen, settings.brick_lenth * 72.5, settings.ground_level - settings.brick_lenth, 1)) background.add( Cloud(settings, screen, settings.brick_lenth * 76, settings.ground_level - settings.brick_lenth * 13, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 78, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 79, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 80, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 81, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 82, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 83, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 84, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 85, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 86, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 87, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 88, settings.ground_level - settings.brick_lenth * 8, 3)) background.add( Cloud(settings, screen, settings.brick_lenth * 85, settings.ground_level - settings.brick_lenth * 15, 2)) objects.add( Brick(settings, screen, settings.brick_lenth * 92, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 93, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 94, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 95, settings.ground_level - settings.brick_lenth * 8, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 95, settings.ground_level - settings.brick_lenth * 4, 3)) background.add( Bush(settings, screen, settings.brick_lenth * 90.5, settings.ground_level - settings.brick_lenth, 2)) background.add( Hill(settings, screen, settings.brick_lenth * 97, settings.ground_level - settings.large_hill_height - 2, 2)) objects.add( Brick(settings, screen, settings.brick_lenth * 101, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 102, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 107, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 110, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 113, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 110, settings.ground_level - settings.brick_lenth * 8, 1)) background.add( Cloud(settings, screen, settings.brick_lenth * 106, settings.ground_level - settings.brick_lenth * 11, 1)) background.add( Bush(settings, screen, settings.brick_lenth * 108.5, settings.ground_level - settings.brick_lenth, 3)) background.add( Hill(settings, screen, settings.brick_lenth * 113, settings.ground_level - settings.small_hill_height, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 119, settings.ground_level - settings.brick_lenth * 4, 3)) background.add( Cloud(settings, screen, settings.brick_lenth * 116, settings.ground_level - settings.brick_lenth * 12, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 122, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 123, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 124, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 129, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 130, settings.ground_level - settings.brick_lenth * 8, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 131, settings.ground_level - settings.brick_lenth * 8, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 132, settings.ground_level - settings.brick_lenth * 8, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 130, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 131, settings.ground_level - settings.brick_lenth * 4, 3)) background.add( Bush(settings, screen, settings.brick_lenth * 120.5, settings.ground_level - settings.brick_lenth, 1)) background.add( Cloud(settings, screen, settings.brick_lenth * 124, settings.ground_level - settings.brick_lenth * 11, 3)) background.add( Cloud(settings, screen, settings.brick_lenth * 133, settings.ground_level - settings.brick_lenth * 13, 2)) background.add( Bush(settings, screen, settings.brick_lenth * 138.5, settings.ground_level - settings.brick_lenth, 2)) background.add( Hill(settings, screen, settings.brick_lenth * 145, settings.ground_level - settings.large_hill_height, 2)) background.add( Cloud(settings, screen, settings.brick_lenth * 153, settings.ground_level - settings.brick_lenth * 11, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 135, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 136, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 137, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 138, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 136, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 137, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 138, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 137, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 138, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 138, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 141, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 141, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 141, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 141, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 142, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 142, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 142, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 143, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 143, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 144, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 149, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 150, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 150, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 151, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 151, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 151, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 152, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 152, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 152, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 152, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 153, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 153, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 153, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 153, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 156, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 156, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 156, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 156, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 157, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 157, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 157, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 158, settings.ground_level - settings.brick_lenth * 1, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 158, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 159, settings.ground_level - settings.brick_lenth * 1, 4)) background.add( Hill(settings, screen, settings.brick_lenth * 161, settings.ground_level - settings.small_hill_height, 1)) background.add( Cloud(settings, screen, settings.brick_lenth * 164, settings.ground_level - settings.brick_lenth * 13, 1)) background.add( Cloud(settings, screen, settings.brick_lenth * 172, settings.ground_level - settings.brick_lenth * 11, 3)) background.add( Cloud(settings, screen, settings.brick_lenth * 181, settings.ground_level - settings.brick_lenth * 13, 2)) background.add( Cloud(settings, screen, settings.brick_lenth * 201, settings.ground_level - settings.brick_lenth * 11, 1)) background.add( Bush(settings, screen, settings.brick_lenth * 167.5, settings.ground_level - settings.brick_lenth, 1)) background.add( Hill(settings, screen, settings.brick_lenth * 193, settings.ground_level - settings.large_hill_height, 2)) background.add( Hill(settings, screen, settings.brick_lenth * 209, settings.ground_level - settings.small_hill_height, 1)) objects.add( Pipe(settings, screen, settings.brick_lenth * 164, settings.ground_level - settings.brick_lenth * 2, 1)) objects.add( Pipe(settings, screen, settings.brick_lenth * 180, settings.ground_level - settings.brick_lenth * 2, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 169, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 170, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 171, settings.ground_level - settings.brick_lenth * 4, 1)) objects.add( Brick(settings, screen, settings.brick_lenth * 172, settings.ground_level - settings.brick_lenth * 4, 3)) objects.add( Brick(settings, screen, settings.brick_lenth * 182, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 183, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 183, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 184, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 184, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 184, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 185, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 185, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 185, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 185, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 186, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 186, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 186, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 186, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 186, settings.ground_level - settings.brick_lenth * 5, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 187, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 187, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 187, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 187, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 187, settings.ground_level - settings.brick_lenth * 5, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 187, settings.ground_level - settings.brick_lenth * 6, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 188, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 188, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 188, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 188, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 188, settings.ground_level - settings.brick_lenth * 5, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 188, settings.ground_level - settings.brick_lenth * 6, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 188, settings.ground_level - settings.brick_lenth * 7, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth * 5, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth * 6, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth * 7, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 189, settings.ground_level - settings.brick_lenth * 8, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth * 2, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth * 3, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth * 4, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth * 5, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth * 6, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth * 7, 4)) objects.add( Brick(settings, screen, settings.brick_lenth * 190, settings.ground_level - settings.brick_lenth * 8, 4)) objects.add( Flag_Pole(settings, screen, settings.brick_lenth * 199, settings.ground_level - settings.flag_pole_height, 1)) objects.add( Castle(settings, screen, settings.brick_lenth * 203, settings.ground_level - settings.small_castle_height, 1))
def create_cloud(self): new_cloud = Cloud() self.clouds.add(new_cloud) self.all_sprites.add(new_cloud)
# Button setup screen_x, screen_y = pygame.display.get_surface().get_size() button_width = screen_x * .33 button_height = screen_y * .1 # Menu buttons start_button = Button([(screen_x / 2) - button_width / 2, ((screen_y / 2) - button_height / 2) - (button_height / 2) - 15], button_width, button_height, 'Start', 50, screen) level_create_button = Button([(screen_x / 2) - button_width / 2, ((screen_y / 2) - button_height / 2) + (button_height / 2) + 15], button_width, button_height, 'Level creator', 50, screen) quit_button = Button([90, screen_y - 190], 100, 100, 'Quit', 38, screen) clouds = Cloud(screen, screen_x, screen_y, [-150, screen_x + 150], [-450, screen_y + 450], False).clouds clouds_2 = Cloud(screen, screen_x, screen_y, [-150 + screen_x, 2 * screen_x + 150], [-450, screen_y + 450], False).clouds main_menu_is_active = True def __quit(): main_menu_is_active = False pygame.quit() sys.exit(0) cloud_counter = 0 clock = pygame.time.Clock()
def create(self, data): cloud = Cloud(**data) notify(TreeUpdateEvent(cloud.__of__(self.context))) return cloud
def _test_cloud_store_filename(self, config, metadata_provider, provider): """ Store file as encrypted data to cloud. """ database = MetaDataDB(config) database.drop() cloud = Cloud(config, metadata_provider, provider, database).connect() data1 = file("testdata/data1.txt").read() data2 = file("testdata/data2.txt").read() metadata1 = cloud.store_from_filename( "testdata/data1.txt", "testdata/data1.txt") metadata2 = cloud.store_from_filename( "testdata/data2.txt", "testdata/data2.txt") metadata3 = cloud.store_from_filename( "testdata/data2.txt", "testdata/data3.txt") metadata4 = cloud.store_from_filename( "testdata/data2.txt", "testdata/data4.txt") for metadata in cloud.list(): if metadata["key"] == metadata1["key"]: self.assertEqual("testdata/data1.txt", metadata["path"]) if metadata["key"] == metadata2["key"]: self.assertEqual("testdata/data2.txt", metadata["path"]) if metadata["key"] == metadata3["key"]: self.assertEqual("testdata/data3.txt", metadata["path"]) if metadata["key"] == metadata4["key"]: self.assertEqual("testdata/data4.txt", metadata["path"]) cloud.retrieve_to_filename( metadata1, "testdata/new_data1.txt") cloud.retrieve_to_filename( metadata2, "testdata/new_data2.txt") cloud.retrieve_to_filename( metadata3, "testdata/new_data3.txt") cloud.retrieve_to_filename( metadata4, "testdata/new_data4.txt") self.assertEqual(data1, file("testdata/new_data1.txt").read()) self.assertEqual("testdata/data1.txt", metadata1["path"]) self.assertEqual(data2, file("testdata/new_data2.txt").read()) self.assertEqual("testdata/data2.txt", metadata2["path"]) self.assertEqual(data2, file("testdata/new_data3.txt").read()) self.assertEqual("testdata/data3.txt", metadata3["path"]) self.assertEqual(data2, file("testdata/new_data4.txt").read()) self.assertEqual("testdata/data4.txt", metadata4["path"]) cloud.delete(metadata1) cloud.delete(metadata2) cloud.delete(metadata3) cloud.delete(metadata4) cloud.disconnect() os.remove("testdata/new_data1.txt") os.remove("testdata/new_data2.txt") os.remove("testdata/new_data3.txt") os.remove("testdata/new_data4.txt")
b.on() elif color == u'gr\xfcn': r.off() g.on() b.off() elif color == 'cyan': r.off() g.on() b.on() elif color == 'gelb': r.on() g.on() b.off() elif color == 'violett': r.on() g.off() b.on() elif color == u'wei\xdf': r.on() g.on() b.on() elif color == 'aus': r.off() g.off() b.off() cloud = Cloud('light', callback) while True: time.sleep(1)
def main(): """ Main function for `GPGBackup` tool. """ args = parse_args() if args.version: show_version() config = None metadata_provider = None provider = None try: config = Config(args.config) except ConfigError as e: error_exit(e) metadata_bucket = config.config.get("metadata", "bucket") data_bucket = config.config.get("data", "bucket") # Initialize cloud provider and metadata database. if args.provider == "amazon-s3": metadata_provider = amazon.S3(config, metadata_bucket) provider = amazon.S3( config, data_bucket, encryption_method=args.encryption_method) elif args.provider == "sftp": metadata_provider = sftp.Sftp(config, metadata_bucket) provider = sftp.Sftp( config, data_bucket, encryption_method=args.encryption_method) else: error_exit("Unknown cloud provider: {0}".format(args.provider)) cloud = Cloud(config, metadata_provider, provider, MetaDataDB(config)) input_file = None output_file = None if args.inputfile: input_file = args.inputfile if args.outputfile: output_file = args.outputfile exit_value = 0 try: if args.command == "list": metadata_list = cloud.list() if len(metadata_list) == 0: print "No files found." sys.exit(0) show_files(metadata_list, args.verbose) elif args.command == "list-cloud-keys": # This is a utility command to list keys in cloud. cloud.connect() msg = "Cloud metadata keys: " + str(cloud.metadata_provider) print msg print "=" * len(msg) for metadata in cloud.metadata_provider.list_keys().values(): print "Key: {name}\nSize: {size}\n" \ "Last modified: {last_modified}\n".format(**metadata) msg = "Cloud data keys: " + str(cloud.provider) print msg print "=" * len(msg) for metadata in cloud.provider.list_keys().values(): print "Key: {name}\nSize: {size}\n" \ "Last modified: {last_modified}\n".format(**metadata) cloud.disconnect() elif args.command == "list-cloud-data": # This is a utility command to list raw data in cloud. cloud.connect() msg = "Cloud metadata: " + str(cloud.metadata_provider) print msg print "=" * len(msg) for k, data in cloud.metadata_provider.list().items(): print "Key:", k print "Data:", data msg = "Cloud data: " + str(cloud.provider) print msg print "=" * len(msg) for k, data in cloud.provider.list().items(): print "Key:", k print "Data:", data cloud.disconnect() elif args.command == "sync": cloud.connect() cloud.sync() cloud.disconnect() metadata_list = cloud.list() if len(metadata_list) == 0: print "No files found." sys.exit(0) show_files(metadata_list, args.verbose) elif args.command == "backup": if not input_file: error_exit("Local filename not given.") if not output_file: output_file = input_file if os.path.isdir(input_file): cloud.connect() if not backup_directory(cloud, input_file, output_file): print "File already exists: {0}".format(output_file) exit_value = 1 cloud.disconnect() sys.exit(exit_value) elif os.path.isfile(input_file) or os.path.islink(input_file): cloud.connect() if not backup_file(cloud, input_file, output_file): print "File already exists: {0}".format(output_file) exit_value = 1 cloud.disconnect() sys.exit(exit_value) else: error_exit("No such file or directory: '{0}'".format(input_file)) elif args.command == "restore": if not input_file: error_exit("Cloud filename not given.") input_file = os.path.normpath(input_file) if output_file: output_file = os.path.normpath(output_file) # Get the list of files. cloud_list = cloud.list() # First, check whether we have an exact match. cloud.connect() for metadata in cloud_list: if metadata["path"] != input_file: continue if not output_file: output_file = input_file print "Restoring file:", input_file, "->", output_file cloud.retrieve_to_filename(metadata, output_file) cloud.disconnect() sys.exit(0) # Then, try to find all files, that have the same directory. file_found = False for metadata in cloud_list: if not metadata["path"].startswith(input_file + "/"): continue file_found = True if not output_file: local_file = metadata["path"] else: local_file = output_file + "/" + metadata["path"] print "Restoring file:", metadata["path"], "->", local_file cloud.retrieve_to_filename(metadata, local_file) cloud.disconnect() if file_found: sys.exit(0) error_exit("File not found: " + input_file) elif args.command == "remove": if not input_file: error_exit("Cloud filename not given.") # Get the list of files. cloud_list = cloud.list() # First, check whether we have an exact match. cloud.connect() for metadata in cloud_list: if metadata["path"] != input_file: continue print "Removing file:", input_file cloud.delete(metadata) cloud.disconnect() sys.exit(0) # Then, try to find all files, that have the same directory. file_found = False for metadata in cloud_list: if not metadata["path"].startswith(input_file + "/"): continue file_found = True print "Removing file:", metadata["path"] cloud.delete(metadata) cloud.disconnect() if file_found: sys.exit(0) error_exit("File not found: " + input_file) else: error_exit("Unknown command: {0}".format(args.command)) except Exception as e: cloud.disconnect() error_exit(e)
s.on() sleep(0.0019) s.off() sleep(0.0015) i += 1 sleep(1) while (i > 0): s.on() sleep(0.0023) s.off() sleep(0.0015) i -= 2 def callback(state): if state['state']: print('Making coffee') make_coffee() print('Finished making coffee') cloud.set_state({'state': False}) else: print('Make coffee state changed') s = LED(4) cloud = Cloud('coffee', callback) while True: sleep(1)
for i in xrange(1, 4): d = device.GearVR devices.append(d(loc)) for i in xrange(3, 6): d = device.OculusRift devices.append(d(loc)) for i in xrange(6, 11): d = device.PlayStationVR devices.append(d(loc)) # Initialize cloud traffic_level = 'low' cloud_loc = Location("Denver") timeout = 10000 # 10 seconds num_players = len(devices) cloud = Cloud(traffic_level, cloud_loc, timeout, num_players) # Initialize network packet_loss_probability = 0 # % chance of network-related dropped packet network = net.UDP(packet_loss_probability) sim = Simulator(cloud, network, devices) sim.runFor(10 * 60 * 1000) # Number of milliseconds results = sim.getResults() viz = Visualizer(results, map(lambda n: "Device " + str(n), range(1, 11))) viz.plotAverageLatency() # TODO: Be run with passed configurations, create simulator, and produce results