Class: ConstructionPlan

ConstructionPlan()

Defines a construction plan, ie a building. We'll try to fing a good position if non has been provided

Constructor

new ConstructionPlan()

Source:

Members

around

fast check if we can build a dock: returns false if nearest land is farther than the dock dimension if the (object) wantedLand is given, this nearest land should have one of these accessibility if wantedSea is given, this tile should be inside this sea
Source:

Methods

buildOverseaDock()

Find a good island to build a dock.
Source:

checkDockPlacement()

Algorithm taken from checkPlacement in simulation/components/BuildRestriction.js to determine the special dock requirements returns {"land": land index for this dock, "water": amount of water around this spot}
Source:

findDockPosition()

Placement of buildings with Dock build category metadata.proximity is defined when first dock without any territory => we try to minimize distance from our current point metadata.oversea is defined for dock in oversea islands => we try to maximize distance to our current docks (for trade) otherwise standard dock on an island where we already have a cc => we try not to be too far from our territory In all cases, we add a bonus for nearby resources, and when a large extend of water in front ot it.
Source:

getDockAngle()

Algorithm taken from the function GetDockAngle in simulation/helpers/Commands.js
Source:

getFrontierProximity()

return a measure of the proximity to our frontier (including our allies) 0=inside, 1=less than 24m, 2= less than 48m, 3= less than 72m, 4=less than 96m, 5=above 96m
Source:

getResourcesAround()

get the sum of the resources (except food) around, inside a given radius resources have a weight (1 if dist=0 and 0 if dist=size) doubled for wood
Source: