Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ai add land transports #3439

Merged
merged 7 commits into from
May 29, 2018
Merged

Ai add land transports #3439

merged 7 commits into from
May 29, 2018

Conversation

ron-murhammer
Copy link
Member

Add AI support for moving units with land transports. Here is a 27 round test game on Iron War showing the AI moving them and not having any errors:
1527297106541-ironwarai.zip


// Set air units in any territory with no AA (don't move planes to empty territories)
for (final Iterator<Unit> it = sortedUnitAttackOptions.keySet().iterator(); it.hasNext();) {
final Unit unit = it.next();
for (final Unit unit : sortedUnitAttackOptions.keySet()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to move away from iterator since there is potential to have to remove multiple units now.

@@ -95,27 +99,7 @@ public static int findMaxMovementForTransports(final List<ProPurchaseOption> sea
units.removeAll(unitsToIgnore);

// Sort units by attack
units.sort((o1, o2) -> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to a separate method.

@codecov-io
Copy link

Codecov Report

Merging #3439 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3439      +/-   ##
============================================
- Coverage        22%   21.99%   -0.02%     
- Complexity     5912     5914       +2     
============================================
  Files           832      832              
  Lines         71853    71912      +59     
  Branches      11575    11583       +8     
============================================
+ Hits          15813    15816       +3     
- Misses        53953    54011      +58     
+ Partials       2087     2085       -2
Impacted Files Coverage Δ Complexity Δ
.../java/games/strategy/triplea/delegate/Matches.java 45.61% <ø> (ø) 367 <0> (ø) ⬇️
...games/strategy/triplea/ai/pro/util/ProMatches.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...trategy/triplea/ai/pro/util/ProTransportUtils.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...ategy/triplea/ai/pro/data/ProTerritoryManager.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...mes/strategy/triplea/ai/pro/data/ProTerritory.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...mes/strategy/triplea/ai/pro/util/ProMoveUtils.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...es/strategy/triplea/ai/pro/ProNonCombatMoveAi.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...trategy/triplea/ai/pro/data/ProPurchaseOption.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...games/strategy/triplea/ai/pro/ProCombatMoveAi.java 0% <0%> (ø) 0 <0> (ø) ⬇️
.../strategy/triplea/odds/calculator/DummyPlayer.java 36.36% <0%> (+1.13%) 10% <0%> (+1%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e47a246...0703e1e. Read the comment docs.

@ron-murhammer
Copy link
Member Author

Gonna look to merge this in the next day or so since its AI only changes.

Copy link
Member

@RoiEXLab RoiEXLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a quick glance at the code.
Looks good, I like that you extracter some utility methods, it would be great to have a couple of tests for them

@RoiEXLab RoiEXLab merged commit 204e4a6 into master May 29, 2018
@RoiEXLab RoiEXLab deleted the AI_Add_Land_Transports branch May 29, 2018 06:54
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.

3 participants