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

Add check for territory effects blocking units for route finding #3664

Merged
merged 2 commits into from Jul 31, 2018

Conversation

Projects
None yet
4 participants
@ron-murhammer
Copy link
Member

ron-murhammer commented Jul 31, 2018

Overview

Addresses feature request: https://forums.triplea-game.org/topic/945/improve-route-finder-to-consider-territory-effects

Functional Changes

  • Added territory effect check for route finding

Manual Testing Performed

  • Tested Large Middle Earth units that can and can't move through mountains
  • Tested a few standard maps like revised to ensure no side effects

Before & After Screen Shots

Shows a unit that can't move through mountains prioritizing non-mountains territories with route finding.

Before

image

After

image

@ssoloff
Copy link
Member

ssoloff left a comment

👍 That was easy.

return t -> {
return units.stream()
.noneMatch(Matches.unitIsOfTypes(TerritoryEffectHelper.getUnitTypesForUnitsNotAllowedIntoTerritory(t)));
};

This comment has been minimized.

Copy link
@ssoloff

ssoloff Jul 31, 2018

Member

Nit: Since the lambda is a single expression, the block isn't necessary:

return t -> units.stream()
    .noneMatch(Matches.unitIsOfTypes(TerritoryEffectHelper.getUnitTypesForUnitsNotAllowedIntoTerritory(t)));

This comment has been minimized.

Copy link
@ron-murhammer

ron-murhammer Jul 31, 2018

Author Member

Yeah, surprisingly easy though I still managed to be lazy for the 5 lines of code I did change. Good catch. Updated it.

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jul 31, 2018

Codecov Report

Merging #3664 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3664      +/-   ##
============================================
- Coverage     22.54%   22.54%   -0.01%     
- Complexity     5984     5985       +1     
============================================
  Files           822      822              
  Lines         71043    71046       +3     
  Branches      11483    11483              
============================================
  Hits          16016    16016              
- Misses        52936    52940       +4     
+ Partials       2091     2090       -1
Impacted Files Coverage Δ Complexity Δ
...games/strategy/triplea/delegate/MoveValidator.java 52.39% <0%> (-0.06%) 232 <0> (ø)
.../java/games/strategy/triplea/delegate/Matches.java 45.55% <0%> (-0.11%) 367 <0> (ø)
...tegy/engine/message/unifiedmessenger/EndPoint.java 76.47% <0%> (-4.42%) 14% <0%> (-1%)
.../strategy/triplea/odds/calculator/DummyPlayer.java 35.95% <0%> (+1.12%) 10% <0%> (+1%) ⬆️
...rategy/triplea/attachments/UnitTypeComparator.java 53.84% <0%> (+7.69%) 13% <0%> (+1%) ⬆️

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 e5f8b8d...9e4dff2. Read the comment docs.

@ssoloff ssoloff merged commit c8b818e into master Jul 31, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@RoiEXLab RoiEXLab deleted the Routes_Consider_Territory_Effects branch Jul 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.