AI prioritizes its path to buying highly desirable tiles

This commit is contained in:
Yair Morgenstern 2023-06-14 09:58:02 +03:00
parent b776790556
commit c3db8ba971
2 changed files with 5 additions and 2 deletions

View File

@ -161,7 +161,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
val bfs = BFS(cityInfo.getCenterTile()) {
(it.isWater || it.isCityCenter()) && (it.getOwner() == null || it.isFriendlyTerritory(civInfo))
}
repeat(20) { bfs.nextStep() } //
repeat(20) { bfs.nextStep() }
if (!bfs.getReachedTiles()
.any { tile ->

View File

@ -384,7 +384,10 @@ object NextTurnAutomation {
val cityWithLeastCostToBuy = highlyDesirableTile.value.minBy {
it.getCenterTile().aerialDistanceTo(highlyDesirableTile.key)
}
val bfs = BFS(cityWithLeastCostToBuy.getCenterTile()) {
val bfs = BFS(cityWithLeastCostToBuy.getCenterTile(),
// Give higher priority on the way to intermediate tiles with higher ranking stats
{ Automation.rankStatsValue(it.stats.getTileStats(cityWithLeastCostToBuy, civInfo), civInfo).toInt() })
{
it.getOwner() == null || it.getOwner() == civInfo
}
bfs.stepUntilDestination(highlyDesirableTile.key)