Project

General

Profile

Actions

Bug #2456

open

ai: emergency-buy loop has been dead for a decade oops

Added by Sweet Tea Dorminy 23 days ago. Updated 5 days ago.

Status:
In Review
Priority:
Normal
Category:
AI
Target version:
Start date:
11/08/2026
Due date:
% Done:

0%

Estimated time:

Description

dai_manage_cities() resets every city's choice.want to -1, then calls dai_spend_gold(), which looks for the city with the highest want. Nothing beats zero, so the loop exits doing nothing. The reset moved ahead of the spend in c84ce356f5 (2017); the buy code has been maintained ever since, so this can't be intended.

Patch spends first, then resets; dai_spend_gold() already marks what it handled.

Same seed, 8 hard AIs, 120 turns: mean treasury 260 -> 66, units built 56 -> 66, mean score 81 -> 104.


Files

Actions #1

Updated by Marko Lindqvist 15 days ago

  • Status changed from New to In Review
  • Assignee set to Marko Lindqvist
  • Target version set to 3.2.8
Actions #2

Updated by Dean Brown 5 days ago

As noted on Fluxer, I tested this patch and found it made a big improvement. One minor quibble - the issue Subject is a bit misleading, it's not "emergency-buy", it's any buy.

Actions

Also available in: Atom PDF