Abbreviations:
FXT = Fat X Tile(s) (e.g. any of the 21 tiles in the fat X, including the center tile)
FOP = Factor(s) Of Production (e.g. food/hammers/commerce produced by a tile WITHOUT improvements)
fpt = Food Per Turn (number of bread slices of the tile WITH improvements)
hpt = Hammers Per Turn
cpt = Commerce Per Turn
AI_bonusVal (ABV) is computed as follows:
0 if bonus is obsolete
ABV is the sum of
10 for each happiness provided by the tile
10 for each health provided by the tile
For each unit type in the game, add a unit score (US):
4 if the unit requires ONLY this resource
3 if the unit requires this resource plus something else (another resource, building, etc.)
1 per 10% speedup if unit builds are sped by this resource
Double US if this civ can currently build the unit
Multiply US by 3/2 if the civ can't build it, but the required tech is in the era we're currently in
Otherwise, divide US by the number of eras left until the required tech
For each building type in the game, add a building score (BS):
3 if the building requires ONLY this resource
2 if the building requires this resource plus something else (another resource, building, etc.)
1 per 10% speedup if the building is sped by this resource
Double BS if this civ can currently build the building
Multiply BS by 3/2 if the civ can't build it, but the required tech is in the era we're currently in
Otherwise, divide BS by the number of eras left until the required tech
For each project type in the game, add a project score (PS):
1 per 10% speedup if the project is sped by this resource
Double PS if this civ can currently build the project
Multiply PS by 3/2 if the civ can't build it, but the required tech is in the era we're currently in
Otherwise, divide PS by the number of eras left until the required tech
AI_foundValue (AFV) is computed as follows:
0 if any of the following are true:
* Within 2 tiles of another city
* More than 7 FXT are owned by another civ, or off the edge of the map
* More than 7 Bad Tiles (see below) in fat X AND no FXT has a Good Bonus (also see below)
Bad Tile: Tile is impassible or off the edge of the map -> Bad Tile
Tile has 0 food or <= 1 FOP -> Bad Tile
Tile is water with <= 1 food -> 1/2 Bad Tile
Good Bonus: Bonus of a type the civ does not yet have, or only has through trade -> Good Bonus
Bonus has AI_bonusVal > 10 (see XML) -> Good Bonus
* More than 7 FXT are within fat X of another city
* More than 1 (!) FXT is within fat X of a teammate's city
0 if we're looking for a start spot and any of the following are true
* Tile has a goody hut
* Any FXT are off the edge of the map
AFV = 1000 to start
For each FXT, add a FOP score (FS):
If the tile has 2+ food, fs = 20*fpt + 80*hpt + 40*cpt
If the tile has 1 food, fs = 10*fpt + 40*hpt + 20*cpt
If the tile has 0 food, fs = 10*fpt + 20*hpt + 10*cpt
Double FS for the center tile
Multiply FS by 3/2 for the first ring of tiles
For each FXT, add/subtract 1 for each 10% health bonus/penalty (e.g. forest tile->+5)
For each FXT with a bonus:
If we're looking for a start spot, add 10 + 20*AI_bonusVal
If we're not, and the civ already has a bonus of that type connected (not through trade), add 10 + 20*AI_bonusVal
If we're not, and the civ DOESN'T have a bonus of that type connected, add 10 + 80*AI_bonusVal
For each coastal tile in the fat X:
Add 600
If we're looking for a start spot, add 200 more
If we're looking for a start spot, and we don't have a city on this continent yet, add 200 more
For each hills tile in the fat X, add 200
For each river tile in the fat X, add 60
For each tile with fresh water in the fat X, add 80
If we're looking for a start spot, add 10*fpt + 10*hpt + 5*cpt for each tile within distance 5 (yes, this counts the fat X again!)
If we're looking for a start spot, add 100*(distance from starting spot for this civ) (?!?!)
For Barbarians, subtract 200*(distance to nearest city within 8 plots)
For non-barbs, subtract 500*(distance to nearest city within 5 plots)
If this continent
Is not yet settled (by anyone), double AFV
Is settled only by our team, multiply AFV by 3/2
Is settled only by our team and barbs, multiply AFV by 4/3
Is none of the above, but has at least one city from our team, multiply AFV by 5/4
Divide AFV by max(0,(# Bad Tiles)-5) + 3
If the city tile has a bonus, divide AFV by 4
Divide AFV by max(0, (# FXT off our continent)-14) + 2
Whew!