Exemple #1
0
from colorama import Fore, Back, Style

from World import World
from Creature import Creature
from Food import Food
from const import *

colorama.init()

world = []

pos = lambda x, y: '\x1b[%d;%dH' % (x, y)

world = World(10, [0, 1])

world.Create()
world.Print()

iterationCount = 0

while True:
    toPrintObj = []
    world_session = world.get_World()
    creaturesIndexes_session = world.get_CreaturesIndexes()
    foodIndexes_session = world.get_FoodIndexes()
    for creationIndex in world.get_CreaturesIndexes():
        for element in world_session[creationIndex[0]][creationIndex[1]]:
            if (isinstance(element, Creature)):
                step = element.MakeStep(world_session)
                world_session = step[0]
                log = step[1]