Package worldBuilder
Class TerritoryEngine
- java.lang.Object
-
- worldBuilder.TerritoryEngine
-
public class TerritoryEngine extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description TerritoryEngine(Map map)
MeshPoints are grouped into territories, based on what city they are closest too (not in km, but in travel days).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
fall back to the previously saved set of routesvoid
allCities()
find all known cities and add all of their neighbors to the queue to be explored.void
commit()
commit the current set of routesdouble
cost(int from, int to)
compute the cost of traveling from one point to a neighborTradeRoute
outwards(int needed, boolean ocean_too)
Journey outwards from each city until we have covered the map.void
reset()
discard all records of previous expansions to enable new point-to-point routesvoid
set_parms(double t_flat, double t_climb, double t_cross, double min_per_day, double max_days)
update the parameters that guide route selectionboolean
startFrom(int point)
add a new point to the list from which we expand outwards
-
-
-
Constructor Detail
-
TerritoryEngine
public TerritoryEngine(Map map)
MeshPoints are grouped into territories, based on what city they are closest too (not in km, but in travel days). This Engine starts from all of the cities and travels out until it encounters the border (equal travel to either city). This approach is taken from O'Leary, though w/different computations
-
-
Method Detail
-
allCities
public void allCities()
find all known cities and add all of their neighbors to the queue to be explored.
-
reset
public void reset()
discard all records of previous expansions to enable new point-to-point routes
-
startFrom
public boolean startFrom(int point)
add a new point to the list from which we expand outwards- Parameters:
point
- index of point
-
outwards
public TradeRoute outwards(int needed, boolean ocean_too)
Journey outwards from each city until we have covered the map. When we reach a MeshPoint already covered from another city, record it as a possible trade route.- Parameters:
needed
- ... maximum number of routes to generateocean_too
- ... do we want paths to the ocean
-
cost
public double cost(int from, int to)
compute the cost of traveling from one point to a neighbor- Parameters:
from
- origin pointto
- destination point- Returns:
- travel time (in days)
-
set_parms
public void set_parms(double t_flat, double t_climb, double t_cross, double min_per_day, double max_days)
update the parameters that guide route selection- Parameters:
t_flat
- minutes to travel one flat kmt_climb
- minutes to gain 1000 meterst_cross
- minutes to cross a 1M^3/s streammin_per_day
- minutes of travel per daymax_days
- maximum days between cities
-
commit
public void commit()
commit the current set of routes
-
abort
public void abort()
fall back to the previously saved set of routes
-
-