def __init__(self, configuration): """Initialise the builder""" super(PortCreator, self).__init__(configuration) # # Basic properties of the port self.coast_per_port = common.getInt(configuration, 'averageCoastLinePerPort') self.island_must_have_port = common.getTrue(configuration, 'islandMustHavePort') self.min_port_separation = common.getInt(configuration, 'minimumPortSeparation') self.port_location_attempts = common.getInt(configuration, 'portLocationAttempts', 5) self.max_name_length = common.getInt(configuration, 'maxPortNameLength', 9) # # Resource properties properties = configuration.findall('resources/resourceProperties/*') root = configuration.find('resources/resourceProperties') self.property_ranges = dict( (element.tag, common.getFloatTuple(root, element.tag)) for element in properties ) # self.name_generator = serge.blocks.textgenerator.MarkovNameGenerator( serge.blocks.textgenerator.EUROPE ) # # Resource types self.resource_types = [ common.getStrAttr(element, 'name') for element in configuration.findall('resources/resourceTypes/resource') ]
def __init__(self, configuration): """Initialise the builder""" super(PortCreator, self).__init__(configuration) # # Basic properties of the port self.coast_per_port = common.getInt(configuration, 'averageCoastLinePerPort') self.island_must_have_port = common.getTrue(configuration, 'islandMustHavePort') self.min_port_separation = common.getInt(configuration, 'minimumPortSeparation') self.port_location_attempts = common.getInt(configuration, 'portLocationAttempts', 5) self.max_name_length = common.getInt(configuration, 'maxPortNameLength', 9) # # Resource properties properties = configuration.findall('resources/resourceProperties/*') root = configuration.find('resources/resourceProperties') self.property_ranges = dict( (element.tag, common.getFloatTuple(root, element.tag)) for element in properties) # self.name_generator = serge.blocks.textgenerator.MarkovNameGenerator( serge.blocks.textgenerator.EUROPE) # # Resource types self.resource_types = [ common.getStrAttr(element, 'name') for element in configuration.findall('resources/resourceTypes/resource') ]
def __init__(self, configuration): """Initialise the builder""" super(BomberProcedural, self).__init__(configuration) # # Get properties self.symmetry = common.getString(configuration, "symmetry").lower().strip() self.width = common.getInt(configuration, "width") self.height = common.getInt(configuration, "height") self.blocks_between = common.getInt(configuration, "blocksBetweenEnemies") self.destructible_blocks = common.getInt(configuration, "destructibleBlocks") self.keep_clear_distance = common.getInt(configuration, "keepClearDistance") self.maze_like = common.getTrue(configuration, "makeLike")