Пример #1
0
 def from_model(model):
     world = World(size=model['size'], color=model['color']['name'])
     for entity_model in model['entities']:
         world.entities.append(Entity.from_model(entity_model))
     if 'meta' in model:
         world.meta.update(model['meta'])
     return world
Пример #2
0
 def from_model(model):
     world = World(size=model['size'], color=Color.from_model(model['color']))
     for entity_model in model['entities']:
         world.entities.append(Entity.from_model(entity_model))
     return world