|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgames.strategy.triplea.strongAI.SUtils
public class SUtils
| Constructor Summary | |
|---|---|
SUtils()
|
|
| Method Summary | |
|---|---|
static java.util.List<Territory> |
ACTerritory(PlayerID player,
GameData data)
Returns a list of all territories containing owned AirCraft Carriers |
static void |
addUnitCollection(java.util.List<java.util.Collection<Unit>> aUnits,
java.util.Collection<Unit> bUnits)
|
static float |
airstrength(Unit airunit,
boolean attacking)
Determine the available strength of a single air unit Primarily useful for a sea battle needing support Moved from AIUtils to improve portability with changes by others |
static boolean |
airUnitIsLandable(Unit u,
Territory source,
Territory target,
PlayerID owner,
GameData data)
|
static boolean |
airUnitIsLandableOnCarrier(Unit u,
Territory source,
Territory target,
PlayerID player,
GameData data)
|
static float |
allairstrength(java.util.Collection<Unit> units,
boolean attacking)
Determine the strength of a collection of airUnits |
static java.util.List<Territory> |
allAlliedTerritories(GameData data,
PlayerID player)
All Allied TErritories in a modifiable List |
static java.util.List<Territory> |
allEnemyTerritories(GameData data,
PlayerID player)
All Enemy Territories in a modifiable List |
static java.util.List<Territory> |
allOurTerritories(GameData data,
PlayerID player)
Territories we actually own in a modifiable List |
static java.util.Collection<Territory> |
bomberTerrInList(java.util.List<java.util.Collection<Unit>> units,
java.util.List<Route> routes)
Determine if a List has any bombers in it |
static void |
breakUnitsBySpeed(java.util.List<java.util.Collection<Unit>> returnUnits,
GameData data,
PlayerID player,
java.util.List<Unit> units)
Create a List which contains a series of collections each which has a different movement |
static boolean |
calculateTUVDifference(Territory eTerr,
java.util.Collection<Unit> invasionUnits,
java.util.Collection<Unit> defenderUnits,
java.util.HashMap<PlayerID,IntegerMap<UnitType>> costMap,
PlayerID player,
GameData data,
boolean aggressive,
boolean subRestricted)
|
static Territory |
closestAmphibAlliedTerritory(Territory startTerr,
Territory targetTerr,
java.util.List<Territory> contiguousTerritories,
GameData data,
PlayerID player,
boolean tFirst)
Return the closest allied Territory to targetTerr Creates a list of the top 3 closest points and then returns the one with the maximum # of units Always returns a neighbor of startTerr if the neighbor is in the top 3 |
static Territory |
closestEnemyCapital(Territory startTerr,
GameData data,
PlayerID player)
Find enemyCapital closest to startTerr |
static Territory |
closestToEnemyCapital(java.util.List<Territory> ourTerr,
GameData data,
PlayerID player,
boolean byLand)
Takes a List of territories and finds the one closest to an enemy capitol by Land |
static void |
continentAlliedUnitTerr(GameData data,
PlayerID player,
Territory startTerr,
java.util.List<Territory> contiguousTerr,
java.util.List<Territory> ignoreTerr)
Return a list of Territories on a Continent which are allied |
static IntegerMap<UnitType> |
convertListToMap(java.util.Collection<Unit> units)
Map a list of units |
static boolean |
determineAggressiveAttack(GameData data,
PlayerID player,
float aggressiveFactor)
use TUV for a set of allies and their enemies to determine if TUV superiority indicates that a player can be more aggressive in an attack. |
static float |
determineEnemyBlitzStrength(Territory blitzHere,
java.util.List<Route> blitzTerrRoutes,
java.util.List<Territory> blockTerr,
GameData data,
PlayerID ePlayer)
Determine the enemy potential for blitzing a territory - all enemies are combined |
static int |
determineTUV(IntegerMap<UnitType> unitList,
IntegerMap<UnitType> unitCost)
|
static int |
distanceToEnemy(Territory t,
java.util.List<Territory> beenThere,
GameData data,
PlayerID player,
boolean sea)
Recursive routine for finding the distance to an enemy |
static boolean |
doesLandExistAt(Territory t,
GameData data,
boolean neutral)
Does this territory have any land? |
static int |
evaluateNonCombat(int numMoves,
int evalDistance,
java.util.HashMap<java.lang.Integer,java.util.HashMap<Territory,java.lang.Float>> reinforcedTerrList,
java.util.HashMap<java.lang.Integer,IntegerMap<Territory>> unitCountList,
PlayerID player,
GameData data,
boolean tFirst)
|
static Territory |
findASeaTerritoryToPlaceOn(Territory landTerr,
GameData data,
PlayerID player,
boolean tFirst)
Look for an available sea Territory to place sea Units if other owned sea units exist, place them with these units Otherwise, look for the location which is least likely to get them killed |
static java.util.List<Territory> |
findCertainShips(GameData data,
PlayerID player,
Match<Unit> unitCondition)
Return All Territories containing a Certain Owned Unit (Land, Sea or Air) specified by unitCondition |
static Territory |
findFactoryTerritory(GameData data,
PlayerID player,
float risk,
boolean buyfactory,
boolean onWater)
determines a suitable Territory for a factory suitable: At Least 2 PU All Territories around it are owned Strength of Units in the Territory and 1 Territory away Is greater than the sum of all enemy Territory 2 away Territory should be closest to an enemy Capital |
static Route |
findNearest(Territory start,
Match<Territory> endCondition,
Match<Territory> routeCondition,
GameData data)
Find the Route to the nearest Territory |
static Route |
findNearestMaxContaining(Territory start,
Match<Territory> endCondition,
Match<Territory> routeCondition,
Match<Unit> unitCondition,
int maxUnits,
GameData data)
Find Route from start to a Territory having endCondition which has a maximum of a certain set of Units (unitCondition) |
static Territory |
findNearestMaxUnits(PlayerID player,
GameData data,
Territory t,
boolean friendly)
Finds the Territory within 3 Territories which has a maximum # of units Uses friendly to determine if we are looking for our guys or enemy Returns Territory with a maximum # of units (enemy or friendly) |
static Route |
findNearestNotEmpty(Territory start,
Match<Territory> endCondition,
Match<Territory> routeCondition,
GameData data)
|
static java.util.List<Territory> |
findOnlyMyShips(Territory t,
GameData data,
PlayerID player,
Match<Unit> unitCondition)
Identical to findOurShips...just owned rather than allied Could be merged with findOurShips with a boolean for allied Finds all units within 3 Territories of t which match unitCondition returns the List |
static java.util.List<Territory> |
findOurPlanes(Territory t,
GameData data,
PlayerID player)
Returns list of territories within 4 territories of t and contain owned planes |
static java.util.List<Territory> |
findOurShips(Territory t,
GameData data,
PlayerID player)
Returns all Territories which contain Allied Units within a radius of 4 Territories of t Works for land units as well as ships |
static java.util.List<Territory> |
findOurShips(Territory t,
GameData data,
PlayerID player,
Match<Unit> unitCondition)
Returns a list of Territories containing Allied Ships within a radius of 3 which meet the condition |
static boolean |
findPurchaseMix(IntegerMap<ProductionRule> bestAttack,
IntegerMap<ProductionRule> bestDefense,
IntegerMap<ProductionRule> bestTransport,
IntegerMap<ProductionRule> bestMaxUnits,
IntegerMap<ProductionRule> bestMobileAttack,
java.util.List<ProductionRule> rules,
int totPU,
int maxUnits,
GameData data,
PlayerID player,
int fighters)
Take the mix of Production Rules and determine the best purchase set for attack, defense or transport So much more that can be done with this...track units and try to minimize or maximize the # purchased |
static java.util.List<Territory> |
findUnits(Territory t,
GameData data,
Match<Unit> unitCondition,
int maxDist)
Returns a list of territories within maxDist which meat the requirement of unitCondition No requirements of ownership or allied units |
static java.util.List<Territory> |
findUnitTerr(GameData data,
PlayerID player,
Match<Unit> unitCondition)
Return Territories containing any unit depending on unitCondition Differs from findCertainShips because it doesn't require the units be owned |
static int |
getAlliedEnemyTUV(GameData data,
PlayerID player,
boolean allied)
Determine TUV for allies/enemies |
static Territory |
getAlliedLandTerrNextToEnemyCapital(int minDist,
Territory capTerr,
Territory fromTerr,
GameData data,
PlayerID player)
Looking for the closest land territory next to an enemy capital which is owned by an ally Use this for dumping units from transports |
static java.util.List<PlayerID> |
getAlliedPlayers(GameData data,
PlayerID player)
|
static Territory |
getClosestWaterTerr(Territory target,
Territory source,
GameData data,
PlayerID player,
boolean allowEnemy)
find the water terr next to target which is closest to the source target: land destination source: present location minDist: actual distance from source to resulting water terr Returns null if target has no water territories |
static java.util.List<Territory> |
getEnemyCapitals(GameData data,
PlayerID player)
List containing the enemy Capitals |
static java.util.List<PlayerID> |
getEnemyPlayers(GameData data,
PlayerID player)
Returns a list of all enemy players |
static java.util.List<Territory> |
getExactNeighbors(Territory territory,
int distance,
PlayerID player,
boolean neutral)
Gets the neighbors which are exactly a certain # of territories away (distance) Removes the inner circle neighbors neutral - whether to include neutral countries |
static int |
getLeftToSpend(GameData data,
PlayerID player)
Returns the players current pus available |
static Route |
getMaxSeaRoute(GameData data,
Territory start,
Territory destination,
PlayerID player,
boolean attacking,
int maxDistance)
|
static java.util.List<Territory> |
getNeighboringEnemyLandTerritories(GameData data,
PlayerID player)
All the territories that border one of our territories |
static java.util.List<Territory> |
getNeighboringEnemyLandTerritories(GameData data,
PlayerID player,
boolean allied)
All territories that border our terr or allied terr boolean allied - search for enemies of allied territories, not just owned |
static java.util.List<Territory> |
getNeighboringEnemyLandTerritories(GameData data,
PlayerID player,
Territory check)
All the territories that border a certain territory |
static java.util.List<Territory> |
getNeighboringLandTerritories(GameData data,
PlayerID player,
Territory check)
All Allied Territories which neighbor a territory This duplicates getNeighbors(check, Matches.isTerritoryAllied(player, data)) |
static java.util.List<Territory> |
getNeighboringNeutralLandTerritories(GameData data,
PlayerID player,
boolean allied)
All neutral territories that border our terr or allied terr boolean allied - search for neutral near allied territories, not just owned |
static java.util.HashMap<PlayerID,IntegerMap<UnitType>> |
getPlayerCostMap(GameData data)
Generate HashMap of the costs of all players |
static IntegerMap<PlayerID> |
getPlayerTUV(GameData data)
Determine the current TUV strength of all players |
static Territory |
getSafestWaterTerr(Territory target,
Territory source,
java.util.List<Territory> ignoreTerr,
GameData data,
PlayerID player,
boolean allowEnemy,
boolean tFirst)
|
static float |
getStrengthOfPotentialAttackers(Territory location,
GameData data,
PlayerID player,
boolean tFirst,
boolean ignoreOnlyPlanes,
java.util.List<Territory> ignoreTerr)
Returns the strength of all attackers to a territory differentiates between sea and land attack determines all transports within range of territory determines all air units within range of territory (using 2 for fighters and 3 for bombers) does not check for extended range fighters or bombers |
static java.util.List<Territory> |
getTerritoriesWithEnemyNeighbor(GameData data,
PlayerID player,
boolean allied,
boolean neutral)
All allied Territories which have a Land Enemy Neighbor |
static Route |
getTwoRoute(Territory t1,
Territory t2,
Match<Territory> condition,
java.util.List<Territory> blockedTerr,
GameData data)
Make a two step route in which the condition only applies to the middle territory in the route and not the target |
static java.util.List<Unit> |
getUnitsUpToStrength(double maxStrength,
java.util.Collection<Unit> units,
boolean attacking,
boolean sea)
Fill a List with units from the passed list up to maxStrength |
static boolean |
hasLandRouteToEnemyOwnedCapitol(Territory t,
PlayerID player,
GameData data)
true or false...does a land route exist from territory to any enemy owned capitol? |
static float |
inviteBBEscort(Territory goTerr,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player)
|
static float |
inviteBlitzAttack(boolean nonCombat,
Territory enemy,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean attacking,
boolean forced)
Look for possible blitzing units Currently restricts the territory to one to which there are no existing enemy units as neighbors unless forced Use forced to get units to blitz no matter what Should be modified to compare strength of source territory and its neighbors |
static float |
inviteLandAttack(boolean nonCombat,
Territory enemy,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean attacking,
boolean forced,
java.util.List<Territory> alreadyAttacked)
Look for possible land based Attack units Ignores blitzing |
static float |
invitePlaneAttack(boolean noncombat,
boolean fightersOnly,
Territory target,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player)
Territory to which we want airplanes (maybe for an attack) if the target is on water, give preference to water based planes |
static float |
inviteShipAttack(Territory eTerr,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean attacking,
boolean tFirst,
boolean includeTransports)
Invite Ship Attack to a certain sea territory (enemy) Air on a carrier will be included Transports will only be included if tFirst is true Units to be moved will be placed in moveUnits and routes in moveRoutes carrier & fighters will be moved as a single unit |
static float |
inviteTransports(boolean noncombat,
Territory target,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean tFirst,
boolean allowEnemy,
java.util.List<Territory> seaTerrAttacked)
Invite transports to bring units to this location |
static java.util.Collection<Territory> |
islandCapitalTerritories(Territory startTerr,
Territory targetTerr,
GameData data)
Return all land Territories which are within range between startTerr & targetTerr |
static boolean |
isWaterAt(Territory checkTerr,
GameData data)
Does water exist around this territory |
static Territory |
landAttackMap(GameData data,
PlayerID player,
java.util.HashMap<Territory,java.lang.Float> enemyMap)
Prepares a map of the strength of every enemy land Territory Includes neutral if they are attackable |
static boolean |
landRouteToEnemyCapital(Territory thisTerr,
Route goRoute,
GameData data,
PlayerID player)
determines the Land Route to a capital...returns if it exists and puts it in goRoute returns null for the Route if it does not exist |
static boolean |
ListContainsOtherThanTransports(java.util.List<Unit> unitList)
Determine if a list has something other than a transport Use for verifying sea attack |
static java.util.List<Territory> |
possibleBlitzTerritories(Territory checkTerr,
GameData data,
PlayerID player)
Build a list of territories that *could be* used by the enemy for blitzing Doesn't worry about whether blocking units are there or not |
static int |
purchaseLoop(IntegerMap<java.lang.String> parameters,
int ruleNum,
IntegerMap<ProductionRule> bestAttack,
IntegerMap<ProductionRule> bestDefense,
IntegerMap<ProductionRule> bestTransport,
IntegerMap<ProductionRule> bestMaxUnits,
IntegerMap<ProductionRule> bestMobileAttack,
java.util.HashMap<ProductionRule,java.lang.Boolean> transportMap,
java.util.HashMap<ProductionRule,java.lang.Boolean> infMap,
java.util.HashMap<ProductionRule,java.lang.Boolean> nonInfMap,
java.util.HashMap<ProductionRule,java.lang.Boolean> supportableInfMap,
GameData data,
PlayerID player,
int fighters)
Recursive routine to determine the bestAttack and bestDefense set of purchase Expects bestAttack to already be filled with the rules |
static boolean |
quickBattleEstimator(IntegerMap<UnitType> attacker,
IntegerMap<UnitType> defender,
PlayerID aPlayer,
PlayerID dPlayer,
boolean sea,
boolean subRestricted)
Very basic estimation of battle through recursion Determine pips on dice and divide by 6 to get hits Remove weakest attackers/defenders TODO: fix battleEstimator for ships |
static java.util.HashMap<Territory,java.lang.Float> |
rankAmphibReinforcementTerritories(GameData data,
java.util.List<Territory> ignoreTerr,
PlayerID player,
boolean tFirst)
Target Territories for amphibious non-combat movement No Islands will result |
static java.util.HashMap<Territory,java.lang.Float> |
rankTerritories(GameData data,
java.util.List<Territory> ourFriendlyTerr,
java.util.List<Territory> ourEnemyTerr,
java.util.List<Territory> ignoreTerr,
PlayerID player,
boolean tFirst,
boolean waterBased,
boolean nonCombat)
Territory ranking system |
static void |
removeNonAmphibTerritories(java.util.List<Territory> territories,
GameData data)
Remove any territories which cannot be amphibiously invaded |
static IntegerMap<UnitType> |
removeUnits(IntegerMap<UnitType> units,
boolean attacking,
int killNum,
PlayerID player,
boolean sea)
Method for removing a set of units from an IntegerMap of units Major Assumption: Cost Increases: infantry < artillery < armour If Ship is passed through in a land attack it is removed |
static void |
removeUnthreatenedTerritories(GameData data,
PlayerID player,
java.util.List<Territory> terrList)
Remove enemy territories, territories which have no threat and no enemy land neighbor |
static void |
reorder(java.util.List<?> reorder,
IntegerMap map,
boolean greaterThan)
|
static void |
reorder(java.util.List<?> reorder,
java.util.Map<?,? extends java.lang.Number> map,
boolean greaterThan)
|
static Route |
repairRoute(java.util.Collection<Unit> moveUnits,
Route moveRoute,
GameData data,
PlayerID player)
Verify an individual move - Route exists (not null) and there is an endpoint |
static boolean |
RouteHasNoWater(Route testRoute)
Does this Route contain water anywhere Differs from route.crossesWater in that it checks the beginning and end |
static int |
shipThreatToTerr(Territory checkTerr,
GameData data,
PlayerID player,
boolean tFirst)
Determine how many more ships the enemy has than the player fighters on AC are counted also Each ship is given the same value except for BB (two) Transports are treated as 0.5 if tFirst and 0 if not TODO: Add land based fighters and bombers to this list |
static java.util.List<Unit> |
sortTransportUnits(java.util.List<Unit> transUnits)
Interleave infantry and artillery/armor for loading on transports |
static float |
strength(java.util.Collection<Unit> units,
boolean attacking,
boolean sea,
boolean transportsFirst)
Get a quick and dirty estimate of the strength of some units in a battle. |
static float |
strengthOfTerritory(GameData data,
Territory thisTerr,
PlayerID player,
boolean attacking,
boolean sea,
boolean tFirst,
boolean allied)
Determine the strength of a territory |
static float |
strengthOnContinent(GameData data,
PlayerID player,
Territory continentTerr)
Return a players allied strength on the entire continent |
static java.util.List<Territory> |
stripLandLockedTerr(GameData data,
java.util.List<Territory> allTerr)
Returns a List of all territories with a water neighbor |
static IntegerMap<Territory> |
targetTerritories(GameData data,
PlayerID player,
int tDistance)
Look for a set of target Territories based from factories Return Map of these with their production values Islands are considered up to a distance of 5 |
static boolean |
territoryHasThreatenedAlliedFactoryNeighbor(GameData data,
Territory eTerr,
PlayerID player)
Is the territory a neighbor of an allied factory and is that factory threatened? |
static Match<Territory> |
TerritoryIsImpassableToAirUnits(GameData data)
Assumes that water is passable to air units always |
static Match<Territory> |
TerritoryIsNotImpassableToAirUnits(GameData data)
|
static java.util.List<Territory> |
TerritoryOnlyPlanes(GameData data,
PlayerID player)
Finds a list of territories which contain airUnits, but don't have land Units |
static boolean |
threatToAlliedCapitals(GameData data,
PlayerID player,
java.util.List<Territory> threats,
boolean tFirst)
determine the threat to the capital of the player's allies returns boolean true or false whether threat exists returns capitals threatened in threats |
static void |
trimTerritoryList(java.util.List<Territory> xTerrList,
int maxNum)
Trim a list of territories to a maximum number If the list has fewer entries than max number, nothing is done |
static float |
twoAwayStrengthNotCounted(GameData data,
PlayerID player,
Territory eTerr)
|
static float |
uStrength(Unit units,
boolean attacking,
boolean sea,
boolean transportsFirst)
Determine the strength of a single unit |
static void |
verifyMoves(java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player)
Verifies an entire set of moves 1st: Repair routes that are invalid 2nd: Remove transport only attacks |
static float |
verifyPlaneAttack(GameData data,
java.util.List<java.util.Collection<Unit>> xMoveUnits,
java.util.List<Route> xMoveRoutes,
PlayerID player,
java.util.List<Territory> alreadyAttacked)
Look through a list and find planes do not have a good landing point available TODO: Analyze and determine when our units have evacuated the landing points to make an attack |
static java.util.Collection<Unit> |
whatPlanesNeedToLand(boolean doBombers,
Territory thisTerritory,
PlayerID player)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SUtils()
| Method Detail |
|---|
public static boolean threatToAlliedCapitals(GameData data,
PlayerID player,
java.util.List<Territory> threats,
boolean tFirst)
public static java.util.List<Territory> stripLandLockedTerr(GameData data,
java.util.List<Territory> allTerr)
data - allTerr - - List of Territories
public static java.util.Collection<Territory> bomberTerrInList(java.util.List<java.util.Collection<Unit>> units,
java.util.List<Route> routes)
units -
public static Territory landAttackMap(GameData data,
PlayerID player,
java.util.HashMap<Territory,java.lang.Float> enemyMap)
data - player - enemyMap -
public static Match<Territory> TerritoryIsImpassableToAirUnits(GameData data)
data -
public static final Match<Territory> TerritoryIsNotImpassableToAirUnits(GameData data)
public static void continentAlliedUnitTerr(GameData data,
PlayerID player,
Territory startTerr,
java.util.List<Territory> contiguousTerr,
java.util.List<Territory> ignoreTerr)
data - player - startTerr - contiguousTerr - - actual list to be createdignoreTerr - - cannot be null (should be an empty List
public static float strengthOnContinent(GameData data,
PlayerID player,
Territory continentTerr)
data - player - continentTerr -
public static void removeUnthreatenedTerritories(GameData data,
PlayerID player,
java.util.List<Territory> terrList)
data - player - terrList -
public static void breakUnitsBySpeed(java.util.List<java.util.Collection<Unit>> returnUnits,
GameData data,
PlayerID player,
java.util.List<Unit> units)
returnUnits - data - player - units -
public static IntegerMap<Territory> targetTerritories(GameData data,
PlayerID player,
int tDistance)
data - player -
public static java.util.List<Unit> sortTransportUnits(java.util.List<Unit> transUnits)
public static java.util.HashMap<PlayerID,IntegerMap<UnitType>> getPlayerCostMap(GameData data)
public static void trimTerritoryList(java.util.List<Territory> xTerrList,
int maxNum)
xTerrList - maxNum - - maxNum of entries
public static int evaluateNonCombat(int numMoves,
int evalDistance,
java.util.HashMap<java.lang.Integer,java.util.HashMap<Territory,java.lang.Float>> reinforcedTerrList,
java.util.HashMap<java.lang.Integer,IntegerMap<Territory>> unitCountList,
PlayerID player,
GameData data,
boolean tFirst)
public static IntegerMap<PlayerID> getPlayerTUV(GameData data)
public static java.util.Collection<Territory> islandCapitalTerritories(Territory startTerr,
Territory targetTerr,
GameData data)
startTerr - targetTerr - data -
public static Territory closestAmphibAlliedTerritory(Territory startTerr,
Territory targetTerr,
java.util.List<Territory> contiguousTerritories,
GameData data,
PlayerID player,
boolean tFirst)
startTerr - targetTerr - data - contiguousTerritories - - Set of 3 potential landing pointsplayer - tFirst -
public static Territory closestEnemyCapital(Territory startTerr,
GameData data,
PlayerID player)
startTerr - data - player -
public static boolean calculateTUVDifference(Territory eTerr,
java.util.Collection<Unit> invasionUnits,
java.util.Collection<Unit> defenderUnits,
java.util.HashMap<PlayerID,IntegerMap<UnitType>> costMap,
PlayerID player,
GameData data,
boolean aggressive,
boolean subRestricted)
public static int determineTUV(IntegerMap<UnitType> unitList,
IntegerMap<UnitType> unitCost)
public static java.util.List<Territory> getNeighboringEnemyLandTerritories(GameData data,
PlayerID player)
public static java.util.List<Territory> getTerritoriesWithEnemyNeighbor(GameData data,
PlayerID player,
boolean allied,
boolean neutral)
public static java.util.List<Territory> getNeighboringEnemyLandTerritories(GameData data,
PlayerID player,
boolean allied)
public static java.util.List<Territory> getNeighboringNeutralLandTerritories(GameData data,
PlayerID player,
boolean allied)
public static Territory getClosestWaterTerr(Territory target,
Territory source,
GameData data,
PlayerID player,
boolean allowEnemy)
public static Territory getSafestWaterTerr(Territory target,
Territory source,
java.util.List<Territory> ignoreTerr,
GameData data,
PlayerID player,
boolean allowEnemy,
boolean tFirst)
public static java.util.List<Territory> possibleBlitzTerritories(Territory checkTerr,
GameData data,
PlayerID player)
checkTerr - - Territory which enemy would blitzdata - player -
public static java.util.List<Territory> getNeighboringEnemyLandTerritories(GameData data,
PlayerID player,
Territory check)
public static java.util.List<Territory> getNeighboringLandTerritories(GameData data,
PlayerID player,
Territory check)
public static boolean doesLandExistAt(Territory t,
GameData data,
boolean neutral)
public static int distanceToEnemy(Territory t,
java.util.List<Territory> beenThere,
GameData data,
PlayerID player,
boolean sea)
t - beenThere - - list of territories already checkeddata - player -
public static java.util.List<Territory> getEnemyCapitals(GameData data,
PlayerID player)
public static java.util.List<PlayerID> getEnemyPlayers(GameData data,
PlayerID player)
data - player -
public static Territory getAlliedLandTerrNextToEnemyCapital(int minDist,
Territory capTerr,
Territory fromTerr,
GameData data,
PlayerID player)
public static boolean landRouteToEnemyCapital(Territory thisTerr,
Route goRoute,
GameData data,
PlayerID player)
thisTerr - - Territory to be checkedgoRoute - - contains the actual route
public static java.util.List<Unit> getUnitsUpToStrength(double maxStrength,
java.util.Collection<Unit> units,
boolean attacking,
boolean sea)
public static java.util.List<Territory> TerritoryOnlyPlanes(GameData data,
PlayerID player)
public static Territory findNearestMaxUnits(PlayerID player,
GameData data,
Territory t,
boolean friendly)
public static java.util.Collection<Unit> whatPlanesNeedToLand(boolean doBombers,
Territory thisTerritory,
PlayerID player)
public static float getStrengthOfPotentialAttackers(Territory location,
GameData data,
PlayerID player,
boolean tFirst,
boolean ignoreOnlyPlanes,
java.util.List<Territory> ignoreTerr)
tFirst - - can transports be killed before other sea unitsignoreOnlyPlanes - - if true, returns 0.0F if only planes can attack the territory
public static java.util.List<Territory> findOurShips(Territory t,
GameData data,
PlayerID player)
public static java.util.List<Territory> findOurShips(Territory t,
GameData data,
PlayerID player,
Match<Unit> unitCondition)
unitCondition - - Match condition
public static java.util.List<Territory> findOnlyMyShips(Territory t,
GameData data,
PlayerID player,
Match<Unit> unitCondition)
public static java.util.List<Territory> findCertainShips(GameData data,
PlayerID player,
Match<Unit> unitCondition)
public static java.util.List<Territory> findUnitTerr(GameData data,
PlayerID player,
Match<Unit> unitCondition)
public static java.util.List<Territory> findOurPlanes(Territory t,
GameData data,
PlayerID player)
public static java.util.List<Territory> findUnits(Territory t,
GameData data,
Match<Unit> unitCondition,
int maxDist)
public static java.util.List<Territory> allOurTerritories(GameData data,
PlayerID player)
public static java.util.List<Territory> allAlliedTerritories(GameData data,
PlayerID player)
public static java.util.List<Territory> allEnemyTerritories(GameData data,
PlayerID player)
public static Route findNearest(Territory start,
Match<Territory> endCondition,
Match<Territory> routeCondition,
GameData data)
start - - starting territoryendCondition - - condition for the ending TerritoryrouteCondition - - condition for each Territory in Routedata -
public static Route findNearestMaxContaining(Territory start,
Match<Territory> endCondition,
Match<Territory> routeCondition,
Match<Unit> unitCondition,
int maxUnits,
GameData data)
start - - initial territoryendCondition - - final territory must match thisrouteCondition - - all territories on route must match thisunitCondition - - units must match thismaxUnits - - how many units were found there
public static Route findNearestNotEmpty(Territory start,
Match<Territory> endCondition,
Match<Territory> routeCondition,
GameData data)
public static boolean hasLandRouteToEnemyOwnedCapitol(Territory t,
PlayerID player,
GameData data)
public static boolean airUnitIsLandableOnCarrier(Unit u,
Territory source,
Territory target,
PlayerID player,
GameData data)
public static boolean airUnitIsLandable(Unit u,
Territory source,
Territory target,
PlayerID owner,
GameData data)
public static java.util.List<Territory> ACTerritory(PlayerID player,
GameData data)
public static void addUnitCollection(java.util.List<java.util.Collection<Unit>> aUnits,
java.util.Collection<Unit> bUnits)
public static float airstrength(Unit airunit,
boolean attacking)
public static float allairstrength(java.util.Collection<Unit> units,
boolean attacking)
public static float uStrength(Unit units,
boolean attacking,
boolean sea,
boolean transportsFirst)
public static float strength(java.util.Collection<Unit> units,
boolean attacking,
boolean sea,
boolean transportsFirst)
units - - the units to measureattacking - - are the units on attack or defensesea - - calculate the strength of the units in a sea or land battle?
public static Territory findFactoryTerritory(GameData data,
PlayerID player,
float risk,
boolean buyfactory,
boolean onWater)
data - player - risk - - not really used...should pass a relative risk backbuyfactory -
public static java.util.List<Territory> getExactNeighbors(Territory territory,
int distance,
PlayerID player,
boolean neutral)
public static boolean RouteHasNoWater(Route testRoute)
testRoute -
public static Territory findASeaTerritoryToPlaceOn(Territory landTerr,
GameData data,
PlayerID player,
boolean tFirst)
landTerr - - factory territorytFirst - - can transports be killed during battle
Should be modified to include the list of units which will be dropped (for strength measurement)
public static float inviteBBEscort(Territory goTerr,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player)
public static float inviteShipAttack(Territory eTerr,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean attacking,
boolean tFirst,
boolean includeTransports)
public static float inviteTransports(boolean noncombat,
Territory target,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean tFirst,
boolean allowEnemy,
java.util.List<Territory> seaTerrAttacked)
noncombat - - is this in noncombattarget - - Land Territory needing unitsremainingStrengthNeeded - - how many units we needed moved to this locationunitsAlreadyMoved - - List of Units which is not available for further movement
public static float invitePlaneAttack(boolean noncombat,
boolean fightersOnly,
Territory target,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player)
noncombat - fightersOnly - - ignore anything that cannot land on ACwithCarrier - - fighters on Carriers are accompanied by carriertarget - - target territoryremainingStrengthNeeded - - use to determine how many to bringunitsAlreadyMoved - - Units not available for further movement
public static float inviteLandAttack(boolean nonCombat,
Territory enemy,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean attacking,
boolean forced,
java.util.List<Territory> alreadyAttacked)
enemy - - territory to be invadedremainingStrengthNeeded - - total strength of units needed - stop adding when this reaches 0.0
public static float inviteBlitzAttack(boolean nonCombat,
Territory enemy,
float remainingStrengthNeeded,
java.util.Collection<Unit> unitsAlreadyMoved,
java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player,
boolean attacking,
boolean forced)
public static Territory closestToEnemyCapital(java.util.List<Territory> ourTerr,
GameData data,
PlayerID player,
boolean byLand)
ourTerr - byLand - - force the route to be traced by Land
public static Route getTwoRoute(Territory t1,
Territory t2,
Match<Territory> condition,
java.util.List<Territory> blockedTerr,
GameData data)
blockedTerr - - List of Territories the route cannot pass through
public static float determineEnemyBlitzStrength(Territory blitzHere,
java.util.List<Route> blitzTerrRoutes,
java.util.List<Territory> blockTerr,
GameData data,
PlayerID ePlayer)
blitzHere - - Territory expecting to be blitzedblitzTerr - - Territory which is being blitzed through (not guaranteed to be all possible route territories!)data - ePlayer - - the enemy Player
public static boolean ListContainsOtherThanTransports(java.util.List<Unit> unitList)
unitList - - List of units
public static void verifyMoves(java.util.List<java.util.Collection<Unit>> moveUnits,
java.util.List<Route> moveRoutes,
GameData data,
PlayerID player)
moveUnits - moveRoutes - data - player -
public static Route repairRoute(java.util.Collection<Unit> moveUnits,
Route moveRoute,
GameData data,
PlayerID player)
moveUnits - moveRoute -
public static boolean isWaterAt(Territory checkTerr,
GameData data)
checkTerr -
public static IntegerMap<UnitType> convertListToMap(java.util.Collection<Unit> units)
units -
public static boolean quickBattleEstimator(IntegerMap<UnitType> attacker,
IntegerMap<UnitType> defender,
PlayerID aPlayer,
PlayerID dPlayer,
boolean sea,
boolean subRestricted)
attacker - - IntegerMap of number of attacking units (returns adjusted #s)defender - - IntegerMap of number of defending units
public static float strengthOfTerritory(GameData data,
Territory thisTerr,
PlayerID player,
boolean attacking,
boolean sea,
boolean tFirst,
boolean allied)
data - thisTerr - player - attacking - - attacking strength or defendingsea - tFirst - allied - - allied = true - all allied units --> false - owned units only
public static float verifyPlaneAttack(GameData data,
java.util.List<java.util.Collection<Unit>> xMoveUnits,
java.util.List<Route> xMoveRoutes,
PlayerID player,
java.util.List<Territory> alreadyAttacked)
data - xMoveUnits - xMoveRoutes - player - alreadyAttacked -
public static IntegerMap<UnitType> removeUnits(IntegerMap<UnitType> units,
boolean attacking,
int killNum,
PlayerID player,
boolean sea)
units - - Units and #attacking - killNum - - # of units to kill
public static int shipThreatToTerr(Territory checkTerr,
GameData data,
PlayerID player,
boolean tFirst)
checkTerr - - territory to be checkeddata - player - attackAdv - - total advantage the enemy hastFirst - - can transports be killed before other units
public static void removeNonAmphibTerritories(java.util.List<Territory> territories,
GameData data)
territories - data -
public static void reorder(java.util.List<?> reorder,
IntegerMap map,
boolean greaterThan)
public static void reorder(java.util.List<?> reorder,
java.util.Map<?,? extends java.lang.Number> map,
boolean greaterThan)
public static boolean findPurchaseMix(IntegerMap<ProductionRule> bestAttack,
IntegerMap<ProductionRule> bestDefense,
IntegerMap<ProductionRule> bestTransport,
IntegerMap<ProductionRule> bestMaxUnits,
IntegerMap<ProductionRule> bestMobileAttack,
java.util.List<ProductionRule> rules,
int totPU,
int maxUnits,
GameData data,
PlayerID player,
int fighters)
public static int purchaseLoop(IntegerMap<java.lang.String> parameters,
int ruleNum,
IntegerMap<ProductionRule> bestAttack,
IntegerMap<ProductionRule> bestDefense,
IntegerMap<ProductionRule> bestTransport,
IntegerMap<ProductionRule> bestMaxUnits,
IntegerMap<ProductionRule> bestMobileAttack,
java.util.HashMap<ProductionRule,java.lang.Boolean> transportMap,
java.util.HashMap<ProductionRule,java.lang.Boolean> infMap,
java.util.HashMap<ProductionRule,java.lang.Boolean> nonInfMap,
java.util.HashMap<ProductionRule,java.lang.Boolean> supportableInfMap,
GameData data,
PlayerID player,
int fighters)
parameters - - set of parameters to be used (8 of them)ruleNum - - which rule should the routine usebestAttack - - list of the rules and the number to be purchased (optimized for attack)bestDefense - - list of the rules and the number to be purchased (optimized for defense)bestTransport - - list of the rules and the number to be purchased (optimized for transporting)bestMaxUnits - - list of the rules and the number to be purchased (optimized for attack and max units)bestTransport - - list of the rules and the number to be purchased (optimized for transport)
public static java.util.List<PlayerID> getAlliedPlayers(GameData data,
PlayerID player)
public static boolean determineAggressiveAttack(GameData data,
PlayerID player,
float aggressiveFactor)
data - player - aggressiveFactor - - float which will set how much more TUV is needed to allow aggressive
public static int getAlliedEnemyTUV(GameData data,
PlayerID player,
boolean allied)
data - player - allied - - boolean indicating for which set to gather TUV
public static Route getMaxSeaRoute(GameData data,
Territory start,
Territory destination,
PlayerID player,
boolean attacking,
int maxDistance)
public static int getLeftToSpend(GameData data,
PlayerID player)
data - player -
public static boolean territoryHasThreatenedAlliedFactoryNeighbor(GameData data,
Territory eTerr,
PlayerID player)
data - eTerr - player -
public static java.util.HashMap<Territory,java.lang.Float> rankTerritories(GameData data,
java.util.List<Territory> ourFriendlyTerr,
java.util.List<Territory> ourEnemyTerr,
java.util.List<Territory> ignoreTerr,
PlayerID player,
boolean tFirst,
boolean waterBased,
boolean nonCombat)
data - ourFriendlyTerr - ourEnemyTerr - player - tFirst - waterBased - - attack is Water Based - Remove all terr with no avail waternonCombat - - if nonCombat, emphasize threatened factories over their neighbors
public static float twoAwayStrengthNotCounted(GameData data,
PlayerID player,
Territory eTerr)
public static java.util.HashMap<Territory,java.lang.Float> rankAmphibReinforcementTerritories(GameData data,
java.util.List<Territory> ignoreTerr,
PlayerID player,
boolean tFirst)
data - ignoreTerr - player - tFirst - nonCombat -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||