Exemplo n.º 1
0
 def refresh():
     world = Historia.from_data(hexgen_data, debug)
     return json.dumps({
         'world_data': world.world_data,
         'days': [
             world.get_day()
         ]
     }, cls=JsonEncoder), 200
Exemplo n.º 2
0
    def start():
        """
        Starts a new History
        """
        global world
        global days

        if world is None:
            world = Historia.from_data(hexgen_data, debug)
            days = [world.get_day()]
            return json.dumps({
                'world_data': world.world_data,
                'days': days
            }, cls=JsonEncoder), 200

        return json.dumps({
            'world_data': world.world_data,
            'days': days
        }, cls=JsonEncoder), 200
Exemplo n.º 3
0
    #  3 5 3
    # 2 6 3

    'hexes': [
        [
            { 'x': 0, 'y': 0, 'altitude': 4, 'edges': edges, 'biome': random_biome() },
            { 'x': 0, 'y': 1, 'altitude': 5, 'edges': edges, 'biome': random_biome() },
            { 'x': 0, 'y': 2, 'altitude': 4, 'edges': edges, 'biome': random_biome() }
        ],
        [
            { 'x': 1, 'y': 0, 'altitude': 3, 'edges': edges, 'biome': random_biome() },
            { 'x': 1, 'y': 1, 'altitude': 5, 'edges': edges, 'biome': random_biome() },
            { 'x': 1, 'y': 2, 'altitude': 3, 'edges': edges, 'biome': random_biome() }
        ],
        [
            { 'x': 2, 'y': 0, 'altitude': 2, 'edges': edges, 'biome': random_biome() },
            { 'x': 2, 'y': 1, 'altitude': 6, 'edges': edges, 'biome': random_biome() },
            { 'x': 2, 'y': 2, 'altitude': 3, 'edges': edges, 'biome': random_biome() }
        ]
    ]
}
mock_map = WorldMap(mock_map_data)

mock_manager = Historia(mock_map_data)

def make_mock_country(manager, initial_hex):
    return Country(manager, initial_hex)

def make_mock_pop(province, pop_type, population=10000):
    return Pop(province, pop_type, population)