District module

class District.Armory(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
——-
integer

The rating of the region for the district

class District.BasicDistrict(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.District

Region storing a list of Vertices and a District with functions to determine what the Region is in

Attributes
chaos_levelfloat

The amount of ‘chaos’ or randomness in the generation of the districts, is a value 0-1

probability_of_empty_spacefloat

The amount of empty space in a district, is a value 0-1

max_building_size:

The minimum building size

Methods

generate_district(region)

Generates the district

generate_buildings(region, section)

Generates the buildings for a given region and section of region

generate_buildings(region, section)

Splits a given region into buildings randomly

Parameters
regionRegion

The Region to split into buildings that stores the buildings list

sectionPolygon

The possibly not Region Polygon that needs to be split

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

Parameters
regionRegion

The region to assign buildings to

class District.Castle

Bases: District.District

Methods

determine_rating(region, neighbors, …)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbors, other_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
neighborslist of Regions

the neighboring regions

regionRegion

The region that we are determining the likely hood the district will be in

other_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

generate_district(region)

Generates the buildings for the district

Parameters
regionRegion

The region to assign buildings to

class District.Cathedral

Bases: District.District

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

generate_district(region)

Generates the buildings for the district

Parameters
regionRegion

The region to assign buildings to

class District.Courtyard

Bases: District.District

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

generate_district(region)

Generates the buildings for the district

Parameters
regionRegion

The region to assign buildings to

class District.District

Bases: object

Region storing a list of Vertices and a District with functions to determine what the Region is in

Attributes
chaos_levelfloat

The amount of ‘chaos’ or randomness in the generation of the districts, is a value 0-1

probability_of_empty_spacefloat

The amount of empty space in a district, is a value 0-1

max_building_size:

The minimum building size

Methods

generate(region, chaos_level, probability_of_empty_space, max_building_size)

Generates the district

generate_buildings(region, section, chaos_level, probability_of_empty_space, max_building_size)

Generates the buildings for a given region and section of region

set_chaos_level(new_chaos_level)

Sets the Districts chaos level

get_chaos_level()

Returns the districts chaos_level

set_probability_of_empty_space(new_probability_of_empty_space)

Sets the Districts probability_of_empty_space

get_probability_of_empty_space()

Returns the Districts probability_of_empty_space

set_max_building_size(new_max_building_size)

Sets the Districts max_building_size

get_max_building_size()

Returns the Districts max_building_size

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

generate(region, chaos_level, probability_of_empty_space, max_building_size)

Splits a given region into buildings randomly

Parameters
chaos_levelfloat

The chaos_value for how chaotic the buildings are

probability_of_empty_spacefloat

The amount of empty space to be made

max_building_sizefloat

The minimum building size

regionRegion

The Region to split into buildings that stores the buildings list

generate_buildings(region, section, chaos_level, probability_of_empty_space, max_building_size)

Splits a given region into buildings randomly

Parameters
chaos_levelfloat

The chaos_value for how chaotic the buildings are

probability_of_empty_spacefloat

The amount of empty space to be made

max_building_sizefloat

The minimum building size

regionRegion

The Region to split into buildings that stores the buildings list

sectionPolygon

The possibly not Region Polygon that needs to be split

get_chaos_level()

Gets the ‘chaos_level’ of the district

Returns
float

The ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

Returns
float

The ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

Returns
float

The ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

Parameters
new_chaos_levelfloat

The new value of ‘chaos_level’ of the district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

Parameters
new_max_building_sizefloat

The new value of ‘max_building_size’ of the district

set_probability_of_empty_space(new_probability_of_empty_space)

Sets the value of ‘probability_of_empty_space’ for a district

Parameters
new_probability_of_empty_spacefloat

The new value of ‘probability_of_empty_space’ of the district

class District.Farmland

Bases: District.District

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.Gate(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.HousingHigh(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.HousingLow(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.HousingMid(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.Industrial(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.Market

Bases: District.District

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

generate_district(region)

Generates the buildings for the district

Parameters
regionRegion

The region to assign buildings to

class District.Openland

Bases: District.District

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.Park

Bases: District.District

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.Precinct

Bases: District.District

Methods

determine_rating(region, neighbor_regions, …)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section, …)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, other_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

generate_district(region)

Generates the buildings for the district

Parameters
regionRegion

The region to assign buildings to

class District.Shops(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

class District.Slum(chaos_level, probability_of_empty_space, max_building_size)

Bases: District.BasicDistrict

Methods

determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

generate(region, chaos_level, …)

Splits a given region into buildings randomly

generate_buildings(region, section)

Splits a given region into buildings randomly

generate_district(region)

Generates the buildings for the district within the middle 95% of the area

get_chaos_level()

Gets the ‘chaos_level’ of the district

get_max_building_size()

Gets the ‘max_building_size’ of the district

get_probability_of_empty_space()

Gets the ‘probability_of_empty_space’ of the district

set_chaos_level(new_chaos_level)

Sets the value of ‘chaos_level’ for a district

set_max_building_size(new_max_building_size)

Sets the value of ‘max_building_size’ for a district

set_probability_of_empty_space(…)

Sets the value of ‘probability_of_empty_space’ for a district

static determine_rating(region, neighbor_regions, wall)

Determines the likely hood a given district will be in a region

Parameters
regionRegion

The region that we are determining the likely hood the district will be in

neighbor_regionsList of Regions

Every other region

wallWall

The wall of the city

Returns
integer

The rating of the region for the district

District.d(p, v_start, v_end)

Takes in a vector defined by two points and a point and computes a version of the dot product whose sign can be used to determine which side of the vector it is on.

Parameters
pPoint

A point which we wish to determine which side of the line it is on

v_startPoint

Origin of the vector

v_endPoint

Destination of the vector

Returns
float

The result of the formula

District.normalize_angle(angle)

Normalizes an angle in radians to be in the -pi to +pi range

Parameters
anglefloat

The angle to normalize

Returns
float

The normalized angle