def create_consumable(consumable_type=None, side_effect=None): if consumable_type == None: choice_of_consumable = random.randint(0, 8) if choice_of_consumable == 0: consumable_type = 'health potion' elif choice_of_consumable == 1: consumable_type = 'mana potion' elif choice_of_consumable == 2: consumable_type = 'stamina potion' else: consumable_type = 'food' if consumable_type == 'health potion': life_points_gained = random.randint(1, 6) * 25 weight = life_points_gained / 100 return objects.Potion("health potion ({})".format(life_points_gained), weight, life_points_gained, 0, 0) if consumable_type == 'mana potion': mana_points_gained = random.randint(1, 6) * 10 weight = mana_points_gained / 40 return objects.Potion("mana potion ({})".format(mana_points_gained), weight, 0, mana_points_gained, 0) if consumable_type == 'stamina potion': stamina_points_gained = random.randint(1, 6) * 3 weight = stamina_points_gained / 12 return objects.Potion( "stamina potion ({})".format(stamina_points_gained), weight, 0, 0, stamina_points_gained) if consumable_type == 'food': life_points_gained = random.randint(1, 4) * 5 weight = life_points_gained / 20 if side_effect == None: gain_lose = random.randint(0, 4) if gain_lose == 0: gain_lose = 'gain' else: gain_lose = 'lose' effect = [ 'strength', 'agility', 'endurance', 'intelligence', 'will', 'luck', 'max_life_points', 'max_mana_points', 'max_stamina_points' ] choice_of_effect = random.randint(0, len(effect) - 1) effect_chosen = effect[choice_of_effect] value_of_effect = random.randint(1, 3) if effect_chosen == "max_life_points": value_of_effect = value_of_effect * 15 elif effect_chosen == "max_mana_points": value_of_effect = value_of_effect * 10 elif effect_chosen == "max_stamina_points": value_of_effect = value_of_effect * 3 number_of_rounds = random.randint(1, 5) side_effect = "{} {} {} for {} round(s)".format( gain_lose, value_of_effect, effect_chosen, number_of_rounds) name = objects.foods[random.randint(0, len(objects.foods) - 1)] return objects.Food(name, weight, life_points_gained, side_effect)
def initialize(num_ant, *args): ''' num_ant: int args: pg.sprite.Group[] ''' nest_x, nest_y = random.randrange(0, 800), random.randrange(0, 800) for i in range(num_ant): args[0].add(objects.Ant((nest_x, nest_y), "scout")) args[1].add( objects.Food((random.randrange(0, 800), random.randrange(0, 800)), 50)) args[2].add(objects.Nest((nest_x, nest_y), 50))
def initialize(num_ant, *args): ''' num_ant: int args: pg.sprite.Group[] ''' nest_x, nest_y = objects.world_size / 2, objects.world_size / 2 for i in range(num_ant): args[0].add(objects.Ant((nest_x, nest_y), "finding")) # args[1].add(objects.Food((random.randrange(0, objects.world_size), random.randrange(0, objects.world_size)), 50)) args[1].add(objects.Food((100, 100), 50)) args[2].add(objects.Nest((nest_x, nest_y), 50))
def __init__(self, width, height, start_pos, worm_d=np.array([1, 0]), worm_l=4): """set up game""" self.width = width self.height = height self.worm = ob.Worm(start_pos, worm_d, worm_l) p = [random.randint(0, width - 1), random.randint(0, height - 1)] self.food = ob.Food(np.array(p)) self.next_dir = None self.extend = False self.score = 0 self.highscore = 0
def get_random_items(game, room, item_count, treasure_count): items = [] for i in range(0, item_count + treasure_count): if len(items) + 1 <= room.size: not_unique_pos = 1 while not_unique_pos: not_unique_pos = 0 item_x = randint(room.box['min_x'], room.box['max_x']) item_y = randint(room.box['min_y'], room.box['max_y']) for other_item in items: if other_item.x == item_x and other_item.y == item_y: not_unique_pos = 1 if game.level[item_y][item_x] == '%': not_unique_pos = 1 if treasure_count: if randint(0, 2): items.append( objects.Food(item_x, item_y, randint(0, len(objects.food_list) - 1))) else: items.append(objects.Treasure(item_x, item_y)) treasure_count -= 1 else: item_type = objects.item_types[randint( 0, len(objects.item_types) - 1)] items.append( item_type(item_x, item_y, randint(0, game.level_num))) return items
def game_state1(window, control): # NORMAL joy_ctrl = read_all_controls() can_move = True score_font = pygame.font.SysFont("calibri", 35, True) score = 0 snake = objects.Snake() food = objects.Food(randint(0, 39) * GRID, randint(0, 29) * GRID) MOVE = pygame.USEREVENT + 1 pygame.time.set_timer(MOVE, 42) game = Room() while game.run: for event in pygame.event.get(): if event.type == pygame.QUIT: control["state"] = switch_state(game, states.QUIT) elif event.type == pygame.KEYDOWN: if event.key == pygame.K_RIGHT and not snake.dirs[ "left"] and can_move: snake.dir = Vector(snake.vel, 0, 0) snake.change_direction("right") can_move = False elif event.key == pygame.K_LEFT and not snake.dirs[ "right"] and can_move: snake.dir = Vector(-snake.vel, 0, 0) snake.change_direction("left") can_move = False elif event.key == pygame.K_DOWN and not snake.dirs[ "up"] and can_move: snake.dir = Vector(0, snake.vel, 0) snake.change_direction("down") can_move = False elif event.key == pygame.K_UP and not snake.dirs[ "down"] and can_move: snake.dir = Vector(0, -snake.vel, 0) snake.change_direction("up") can_move = False elif event.key == pygame.K_ESCAPE: switch_state(game, pause_st.pause_state, window, control) elif event.key == pygame.K_b: snake.grow() elif event.type == MOVE: snake.move1() can_move = True if snake.collide(): control["state"] = switch_state(game, states.GAME_OVER) if not no_joystick: if joy.get_button(joy_ctrl["pause"]): switch_state(game, pause_st.pause_state, window, control) if str( joy.get_hat(0) ) == joy_ctrl["left"] and not snake.dirs["right"] and can_move: snake.dir = Vector(-snake.vel, 0, 0) snake.change_direction("left") can_move = False elif str( joy.get_hat(0) ) == joy_ctrl["right"] and not snake.dirs["left"] and can_move: snake.dir = Vector(snake.vel, 0, 0) snake.change_direction("right") can_move = False elif str( joy.get_hat(0) ) == joy_ctrl["up"] and not snake.dirs["down"] and can_move: snake.dir = Vector(0, -snake.vel, 0) snake.change_direction("up") can_move = False elif str( joy.get_hat(0) ) == joy_ctrl["down"] and not snake.dirs["up"] and can_move: snake.dir = Vector(0, snake.vel, 0) snake.change_direction("down") can_move = False window.fill((16, 16, 16)) if snake.eat(food): snake.grow() score += 1 food = food.respawn(39, 29, snake) snake.show(window) food.show(window) window.blit( score_font.render("SCORE: " + str(score), True, (255, 255, 255)), (WIDTH // 2 - 72, 38)) show_fps(window) pygame.display.flip() clock.tick(60) save_best_score(score) if score >= 40: unlock_game(2)
def run(self): dt = datetime.now() #Eye tracker configure eyetracker = EyeTracker(self.disp) eyetracker.calibrate() self.disp.fill(self.canvas) self.disp.show() #self.disp.mousevis = True eyetracker.start_recording() etObject = objects.EyeTracker(0, 0, 20, 20) ##END main_music = pygame.mixer.music.load("media/sounds/megalovania.wav") pygame.mixer.music.play() pygame.mixer.music.set_volume(0.6) bob = self.player # List to hold all the sprites all_sprite_list = pygame.sprite.Group() # Make the walls. (x_pos, y_pos, width, height) wall_list = pygame.sprite.Group() # List of Foods food_list = pygame.sprite.Group() wall = objects.Wall("", 0, 40, 10, 560, 1) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) wall = objects.Wall("", 10, 40, 980, 10, 1) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) wall = objects.Wall("", 990, 40, 10, 560, 1) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) wall = objects.Wall("", 10, 590, 980, 10, 1) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) ## Gondulas wall = objects.Wall("", 100, 200, 226, 40, 8) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) wall = objects.Wall("", 100, 400, 226, 40, 8) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) wall = objects.Wall("", 620, 200, 226, 40, 8) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) wall = objects.Wall("", 620, 400, 226, 40, 8) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) wall = objects.Wall("", 450, 220, 40, 226, 9) wall_list.add(wall) all_sprite_list.add(wall) obstacles.append(wall) ## ATM atm_list = pygame.sprite.Group() atm = objects.ATM("", 940, 45, 13, 35, 1) atm_list.add(atm) all_sprite_list.add(atm) ## Monsters monster_list = pygame.sprite.Group() fFood = objects.FastFood("", 850, 400, 30, 30, 3) monster_list.add(fFood) all_sprite_list.add(fFood) fFood2 = objects.FastFood("", 500, 130, 30, 30, 3) monster_list.add(fFood2) all_sprite_list.add(fFood2) fFood = objects.FastFood("", 270, 100, 30, 30, 3) monster_list.add(fFood) all_sprite_list.add(fFood) fFood = objects.FastFood("", 220, 450, 30, 30, 3) monster_list.add(fFood) all_sprite_list.add(fFood) fFood = objects.FastFood("", 450, 470, 30, 30, 4) monster_list.add(fFood) all_sprite_list.add(fFood) ## bob.walls = wall_list all_sprite_list.add(bob) bob.updateValues() #pygame.draw.rect(self.screen, (255,0,0) ,((bob.position),(bob.collisionWidth, bob.collisionHeight)),0) for wall in obstacles: pygame.draw.rect(self.screen, (0, 0, 0), wall.rect, 0) time_decrement = pygame.USEREVENT + 1 T1 = 1000 # second pygame.time.set_timer(time_decrement, T1) card_generator = pygame.USEREVENT + 2 T2 = 4000 # 4 second pygame.time.set_timer(card_generator, T2) monster_move = pygame.USEREVENT + 3 T3 = 100 # 0,1 second pygame.time.set_timer(monster_move, T3) food_time = pygame.USEREVENT + 4 T4 = 8000 # 8 seconds pygame.time.set_timer(food_time, T4) eyeTracker_time = pygame.USEREVENT + 5 T5 = 1000 # 1 seconds pygame.time.set_timer(eyeTracker_time, T5) logRecord_time = pygame.USEREVENT + 6 T6 = 1000 # 1 seconds pygame.time.set_timer(logRecord_time, T6) #gravar tempo que comeca uma fixacao logRecord_fixation = pygame.USEREVENT + 7 T7 = 1000 #2seconds pygame.time.set_timer(logRecord_fixation, T7) cards_hit_list = pygame.sprite.spritecollide(bob, cards_list, False) bground = BackGround(self.screen) cont_blinks = 0 gameRunning = True staring = False position = 0 blinkCount = 0 lastBlinkPos = (0, 0) x = random.randint(50, 800) y = random.randint(50, 400) cash = objects.Cash("", x, y, 20, 20, 2) cards_list.append(cash) pygame.draw.rect(self.screen, (0, 255, 0), cash.rect, 0) all_sprite_list.add(cash) #comeco do game while (gameRunning): self.canvas.clear() self.screen.fill((255, 255, 255)) self.screen.blit(self.image, (0, 40)) clock.tick(60) cards_hit_list = pygame.sprite.spritecollide( bob, cards_list, False) monster_hit_list = pygame.sprite.spritecollide( bob, monster_list, False) atm_hit_list = pygame.sprite.spritecollide(bob, atm_list, False) food_hit_list = pygame.sprite.spritecollide(bob, food_list, False) etSawList = pygame.sprite.spritecollide(etObject, food_list, False) if (len(etSawList) == 0): staring = False for atm in atm_hit_list: if (bob.direction == "up"): bob.rect.top = atm.rect.bottom elif (bob.direction == "right"): bob.rect.right = atm.rect.left elif (bob.direction == "left"): bob.rect.left = atm.rect.right for monster in monster_hit_list: pygame.mixer.music.fadeout(1000) pygame.mixer.Sound.play(go_sound) pygame.time.delay(3500) gameRunning = False for card in cards_hit_list: bob.c_card += 1 pygame.mixer.Sound.play(card_sound) cards_list.remove(card) all_sprite_list.remove(card) #self.avalgame.storeCreditCollection(self.startTime) for food in food_hit_list: if (event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN and bob.cash >= food.value): bob.buyFood(food) food_list.empty() self.player.total_produtos += 1 if (bob.score >= 10): gameRunning = False ##### FRAME EVENTS ## Time Decrementer for event in pygame.event.get(): if (event.type == time_decrement): bob.time -= 1 if (event.type == eyeTracker_time): #verificar se houve fixacao time = libtime.get_time() getX, getY = eyetracker.sample() self.dataStore.get_quadrant((getX, getY)) self.dataStore.start_fixation((getX, getY)) if (event.type == logRecord_time): etObject.setPosition(eyetracker.sample()) for food in etSawList: self.dataStore.start_staring(food.food_type) if (event.type == MOUSEBUTTONDOWN): start_time = eyetracker.wait_for_event(3) time_end = eyetracker.wait_for_event(4) # cont_blinks += 1 self.dataStore.start_blinking(str(cont_blinks), start_time, time_end) tracker_pos = eyetracker.sample() if (tracker_pos != lastBlinkPos): self.dataStore.start_blinkingTest( lastBlinkPos, blinkCount) lastBlinkPos = tracker_pos blinkCount = 1 else: blinkCount += 1 if (event.type == food_time): food_list.empty() newFood1 = objects.Food(5, "vegetal") food_list.add(newFood1) newFood2 = objects.Food(5, "carbohidrato") food_list.add(newFood2) newFood3 = objects.Food(5, "doce") food_list.add(newFood3) newFood4 = objects.Food(5, "proteina") food_list.add(newFood4) ## Credit Card Generator if (event.type == card_generator and len(cards_list) < 2): cashGenerator = random.randint(0, 100) if (cashGenerator <= 25): x = random.randint(50, 800) y = random.randint(50, 400) cash = objects.Cash("", x, y, 20, 20, 2) cards_list.append(cash) pygame.draw.rect(self.screen, (0, 255, 0), cash.rect, 0) all_sprite_list.add(cash) ## Monster Movement if (event.type == monster_move): for monster in monster_list: monsterCollision = pygame.sprite.spritecollide( monster, wall_list, False) if (monster.movingPositive): if (len(monsterCollision) == 0): if monster.obj_type == 4: monster.rect.left -= 15 else: monster.rect.top -= 15 else: if monster.obj_type == 4: monster.rect.right += 15 monster.movingPositive = False else: monster.rect.bottom += 15 monster.movingPositive = False else: if (len(monsterCollision) == 0): if monster.obj_type == 4: monster.rect.right += 15 else: monster.rect.bottom += 15 else: if monster.obj_type == 4: monster.rect.left -= 15 monster.movingPositive = True else: monster.rect.top -= 15 monster.movingPositive = True ## Player Input if (event.type == pygame.KEYDOWN): pygame.event.set_blocked(pygame.KEYDOWN) if (event.key == pygame.K_ESCAPE): gameRunning = False elif (event.key == pygame.K_UP): bob.acceleration = 5 bob.direction = "up" elif (event.key == pygame.K_DOWN): bob.acceleration = 5 bob.direction = "down" elif (event.key == pygame.K_LEFT): bob.acceleration = 5 bob.direction = "left" elif (event.key == pygame.K_RIGHT): bob.acceleration = 5 bob.direction = "right" elif (event.key == pygame.K_RETURN): if (dist(bob.rect.x, bob.rect.y, atm.rect.x, atm.rect.y) <= 65 and bob.c_card >= 1): pygame.mixer.Sound.play(cash_sound) bob.c_card -= 1 bob.cash += 15 self.player.cashTotal += 15 if (event.type == pygame.KEYUP): bob.acceleration = 0 pygame.event.set_allowed(pygame.KEYDOWN) bob.updateValues() if (bob.direction == "up"): bob.moveUp() elif (bob.direction == "down"): bob.moveDown() elif (bob.direction == "left"): bob.moveLeft() elif (bob.direction == "right"): bob.moveRight() if bob.time <= 0: gameRunning = False all_sprite_list.update() all_sprite_list.draw(self.screen) food_list.draw(self.screen) self.screen.blit(bob.timeLabel, (450, 0)) # Player Interface Draw cash_x = 0 cash_y = 20 self.screen.blit(bob.cashLabel, (cash_x, cash_y)) cCard_x = 0 cCard_y = 0 self.screen.blit(bob.c_cardLabel, (cCard_x, cCard_y)) self.screen.blit(bob.scoreLabel, (1000 - bob.scoreLabel.get_rect().width - 50, 0)) ##BARS self.screen.blit(bob.carboLabel, (55, 610)) self.screen.blit(bob.vegLabel, (30, 640)) self.screen.blit(bob.protLabel, (565, 610)) self.screen.blit(bob.doceLabel, (500, 640)) self.progressBars(bob) ##Display #pygame.display.flip() self.disp.fill(self.canvas) self.disp.show() pygame.event.set_allowed(pygame.KEYDOWN) pygame.mixer.music.fadeout(1000) pygame.mixer.music.load("media/sounds/crimson.wav") pygame.mixer.music.play() pyramidCompletion = 0.0 if (self.player.doce == 10): pyramidCompletion += 2.5 if (self.player.proteina == 20): pyramidCompletion += 2.5 if (self.player.vegetal == 30): pyramidCompletion += 2.5 if (self.player.carbohidrato == 40): pyramidCompletion += 2.5 self.avalgame.storePyramidCompletion(self.startTime, valor_AEEJ=pyramidCompletion) foodTotal = 0 if (0 < self.player.total_produtos <= 5): foodTotal = 1 elif (5 < self.player.total_produtos <= 10): foodTotal = 2 elif (self.player.total_produtos > 10): foodTotal = 3 self.avalgame.storeFoodQuantity(self.startTime, valor_AEEJ=foodTotal) if self.player.cashTotal == 0: averageScore = 0 else: averageScore = float( float(self.player.total_produtos) / float(self.player.cashTotal)) * 100 self.avalgame.storeAverageScore(self.startTime, valor_AEEJ=averageScore) self.dataStore.start_blinkingTest(lastBlinkPos, blinkCount) self.dataStore.log_gen.recordBlinkLog(self.dataStore.blink_log, 'blink-', 4, self.avalgame._playerCode) self.dataStore.log_gen.recordLog(self.dataStore.blink_log2, 'blink2-', 4, self.avalgame._playerCode) self.dataStore.log_gen.recordLog(self.dataStore.staring_log, 'products-', 3, self.avalgame._playerCode) self.dataStore.log_gen.recordLog(self.dataStore.quadrant_log, 'quadrants', 2, self.avalgame._playerCode) self.dataStore.log_gen.recordLog(self.dataStore.position_log, 'fixation-', 1, self.avalgame._playerCode) self.avalgame.recordBestScore(self.player.time, self.player.score) ge = GameEnd(self.canvas, self.disp) ge.defScore(bob.score) ge.defResult(bob.score) #ge.storeData(etObject.log) #ge.storeData2(etObject.log2) #ge.storeDataBlink(etObject.log_blink) #ge.storeDataFixation(etObject.log_fixation) ge.run()
#!/usr/bin/python import random import objects all_the_things = { "mesa1": objects.Food(key="mesa1",name="Mesa Bar",description="A chewy energy bar.",longdesc="A well-balanced, chewy energy bar, marketed heavily towards adventurers. Its use of whole rolled oats gives it a chunky texture. " + random.choice(("Also contains large amounts of peanut butter.", "Chocolate chunks are visible between the oats.", "Contains a mixture of whole nuts and seeds.", "This one has dried blueberries in it.", "It's a dark chocoloate brown, possibly trying a little too hard to be a brownie.")),calories=300,caffeine=0,healthy=True), "mesa2": objects.Food(key="mesa2",name="Black Mesa Bar",description="A chewy energy bar with caffeine in it.",longdesc="A well-balanced, chewy energy bar, marketed heavily towards adventurers. It's just like a normal Mesa Bar, but this flavor is caffeinated. " + random.choice(("You think you can see bits of espresso bean in it.", "It's chocolate, and white mint icing is drizzled over the top.")),calories=300,caffeine=100,healthy=True), "tea1": objects.Food(key="tea1",name="cup of green tea",description="A hot covered cup of green tea.",longdesc="This hot cup of green tea steams slightly when the lid is opened. It smells a little bitter.",calories=0,caffeine=100,healthy=True), "tea2": objects.Food(key="tea2",name="cup of black tea",description="A hot covered cup of black tea.",longdesc="This hot cup of black tea steams slightly when the lid is opened. A cursory taste confirms it has a bit of sugar in it.",calories=0,caffeine=100,healthy=True), "tea3": objects.Food(key="tea3",name="bottle of iced tea",description="A cold bottle of iced tea.",longdesc="The label on this bottle of tea proclaims its environmental friendliness and lack of any artifical ingredients. The ingredients list reveals that it contains a rather ridiculous amount of sugar.",calories=20,caffeine=100,healthy=False), "coffee1": objects.Food(key="coffee1",name="cup of black coffee",description="A hot covered cup of black coffee.",longdesc="This hot cup of black coffee steams slightly when the lid is opened. Its aroma permeates the air.",calories=0,caffeine=150,healthy=False), "coffee2": objects.Food(key="coffee2",name="Latteccino",description="A hot covered cup of coffee with milk and syrup.",longdesc="A hot cup of coffee, mixed with milk and sweeteners and covered with a layer of whipped cream. It smells faintly of " + random.choice(("vanilla.", "hazelnuts.", "caramel.", "pumpkin pie spices.", "chocolate.")),calories=200,caffeine=150,healthy=False), "coffee2": objects.Food(key="coffee2",name="Iced Latteccino",description="A cold covered cup of coffee with milk and syrup.",longdesc="A cold cup of coffee, mixed with milk and sweeteners and covered with a layer of whipped cream. It smells faintly of " + random.choice(("vanilla.", "hazelnuts.", "caramel.", "pumpkin pie spices.", "chocolate.")),indef_article="an ",calories=200,caffeine=150,healthy=False), "pizza1": objects.Food(key="pizza1",name="slice of cold pizza",description="A slice of cold pizza.",longdesc="A slice of pizza from last night, or perhaps earlier, topped with " + random.choice(("pepperoni.", "a variety of vegetables.", "chicken and barbeque sauce.", "ham and pineapple.", "curried chicken and vegetables.")),calories=260,caffeine=0,healthy=False), "candy1": objects.Food(key="candy1",name="chocolate covered espresso beans",description="A handful of chocolate-covered coffee beans.",longdesc="A strong scent of coffee emanates from these chocolate-covered candies. Some of them are in stuck-together pairs.",indef_article="some ",calories=200,caffeine=250,healthy=False), "sandwich1": objects.Food(key="sandwich1",name="sub sandwich",description="A footlong sandwich on a roll.",longdesc="This sandwich is conveniently wrapped in waxed paper, and the inside is layered with a few kinds of thinly-sliced meat and vegetables.",calories=700,caffeine=0,healthy=True), "mix1": objects.Food(key="mix1",name="bottle of soylent",description="A bottle of thick protein slush.",longdesc="It's not green, but it is sort of baffling. This thick white liquid is about as bland as plain tofu, but it's pretty filling.",calories=666,caffeine=0,healthy=True), "water1": objects.Food(key="water1",name="bottle of water",description="A bottle of plain water.",longdesc="The label has a picture of some Hawaiian waterfall on it, but it was probably bottled from a tap in New York. You could drink this, but it's not caffeinated or anything. It's just cold water.",calories=0,caffeine=0,healthy=True), "water2": objects.Food(key="water2",name="cup of hot water",description="A cup of plain hot water.",longdesc="It's a covered cup of plain hot water, nearly boiling. You could drink it, carefully, but it wouldn't taste like much of anything.",calories=0,caffeine=0,healthy=True) }
random.uniform(0, 1), random.uniform(0, 1), random.uniform(0, 1), random.uniform(0, 1) ] print(f"gene: {gene} generated") creatures.append( obj.BrainCreature(x=x, y=y, dna=DNA(gene), brain_dna=brain.dna, name='BrainCreature_' + str(obj.creature_id_generator.get_next_id()))) food = [ obj.Food(random.uniform(0, 1000), random.uniform(0, 700)) for i in range(100) ] world = obj.World(1024, 768, creatures=creatures, edibles=food, creature_spawn_interval=1000, food_spawn_interval=1000, random_spawning=False, max_creatures=100) def dump_the_world_pickle(world_to_dump): logger.debug("dumping the world")