Skip to content

Comments

Fix ai sam counting bug#271

Merged
1brucben merged 2 commits intov0.3.0from
samfix
Feb 23, 2026
Merged

Fix ai sam counting bug#271
1brucben merged 2 commits intov0.3.0from
samfix

Conversation

@1brucben
Copy link
Owner

This pull request introduces several changes to the AI construction and nuclear strike evaluation systems, primarily focusing on improving the visibility and debugging of nuke score calculations and removing legacy code. The most significant updates include adding a detailed breakdown of nuke score calculations for debugging purposes, updating the construction debug overlay to display this breakdown, and cleaning up unused code related to the old shared nuke evaluator.

AI Nuke Score Debugging and Calculation Improvements:

  • Added a new NukeScoreBreakdown interface to AINukeHandler that provides a detailed breakdown of all inputs to a nuke score calculation, including enemy/friendly structure values, war score, bomb costs, SAM levels, and the final computed score. This breakdown is now stored for the best atom and hydrogen bomb targets. [1] [2] [3] [4]

  • Updated the construction debug overlay (ConstructionDebugOverlay.ts) to display the detailed nuke score breakdown for both atom and hydrogen bombs, making it easier to understand how the AI evaluates potential nuclear strikes. [1] [2]

Codebase Cleanup and Refactoring:

  • Removed the legacy AINukeEvaluator class and its associated imports, as its functionality has been superseded by the per-player AINukeHandler. This includes deleting the entire src/core/ai/AINukeEvaluator.ts file and cleaning up references in AIConstructionHandler.ts. [1] [2] [3]

  • Removed the shouldDeferToNukes logic and related nuke construction threshold code from AIConstructionHandler, simplifying the construction decision process and eliminating dependency on the old evaluator. [1] [2] [3]

AI Parameter Adjustment:

  • Increased the warshipCoastalThreatWeight parameter in ai-profiles.json from 8e4 to 10e4, slightly increasing the AI's weighting for warship coastal threat assessments.

… scoring breakdowns

- Removed AINukeEvaluator and its associated methods, consolidating functionality into AINukeHandler.
- Introduced NukeScoreBreakdown interface for detailed scoring breakdowns of nuclear targets.
- Updated AIConstructionHandler and ConstructionDebugOverlay to utilize new breakdown data.
- Adjusted AIPlayerExecution to reflect changes in nuke handling and scoring.
- Enhanced debug information with detailed breakdowns for best atom and hydrogen targets.
@1brucben 1brucben merged commit eadcccb into v0.3.0 Feb 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant