def _generate_world(xdim, ydim, sea_tiles): communities = [ Community(default_parameters) for i in range(xdim * ydim) ] for coordinate in sea_tiles: x, y = coordinate communities[x + y * xdim] = Community(default_parameters, landscape=terrain.sea) world = World(xdim, ydim, communities, default_parameters) return world
def strong_polity(): state_size = 20 state = polity.Polity( [Community(default_parameters) for i in range(state_size)]) for tile in state.communities: tile.ultrasocietal_traits = ([True] * default_parameters.n_ultrasocietal_traits) return state
def weak_polity(): state_size = 1 state = polity.Polity( [Community(default_parameters) for i in range(state_size)]) return state
def mediocre_polity(): state_size = 5 state = polity.Polity( [Community(default_parameters) for i in range(state_size)]) return state
def polity_10(): state = polity.Polity( [Community(default_parameters) for i in range(10)] ) return state
def test_new_community(self, polity_10): state = polity_10 state.add_community(Community(default_parameters)) assert state.communities[-1].polity is state
def test_add_community(self, polity_10): state = polity_10 state.add_community(Community(default_parameters)) assert state.size() == 11
def _arbitrary_polity(size): state = polity.Polity( [Community(default_parameters) for i in range(size)] ) return state
def _basic_community(params=default_parameters): return Community(params)
def test_steppe_community(self): tile = Community(default_parameters, landscape=terrain.steppe) assert ( tile.total_military_techs() == default_parameters.n_military_techs)
def advanced_community(): tile = Community(default_parameters) tile.military_techs = [True] * default_parameters.n_military_techs return tile
def world_5x5(): communities = [Community(default_parameters) for i in range(25)] world = World(5, 5, communities, default_parameters) return world
def _generate_world(xdim, ydim, params=default_parameters): communities = [Community(params) for i in range(xdim * ydim)] world = World(xdim, ydim, communities, params) return world