Giter Club home page Giter Club logo

Comments (8)

jimparker96313 avatar jimparker96313 commented on June 15, 2024

As I'm interested in a fix for this too, I thought I'd add this info about the bug.

It affects the history as well with the added caveat that when clicking on territories in the history mode, the engine assumes it is France's turn--regardless of where you select in the history--and only will fill the battle calculator with French units (if there are any, or Axis units since they are the enemy)

I verified that this bug exists in 2.6 release 14247 (could be earlier as I had not checked them) and the latest release 14394.

The battle calculator works as desired (clicking on any territory in current game or history would populate the battle calculator) in the release version 2.5-22294.

from triplea.

asvitkine avatar asvitkine commented on June 15, 2024

This regressed from #9602.

That PR uses the following order for choosing defenders, which seems to prioritize players with no units in such cases:

1. enemy on the same territory
2. any enemy
3. neutral on the same territory
4. any neutral
5. any player

So we end up picking an enemy with no units via 2.
A simple fix could be to change the above to:

1. enemy on the same territory
2. neutral on the same territory
3. player on the same territory
4. any player

The above results in the US being selected as the defender (while attacker is still active player, but with no units, so doesn't matter much).

from triplea.

asvitkine avatar asvitkine commented on June 15, 2024

As an aside, the issue with history is interesting, since I think #10759 was supposed to fix the logic for choosing the active player.

from triplea.

asvitkine avatar asvitkine commented on June 15, 2024

Example repro:

  1. Napoleonic Empires, France (first turn)
  2. Do a battle calc on a Spanish territory (whose an ally)

In 2.5, Spanish units appear as defenders. UK is selected as an attacker (even if there's no units attackers).

In 2.6, France is selected as an attacker (with no units) and UK is selected as a defender (with no units).

Pretty clear that the 2.6 behavior is not what people would want here.

from triplea.

asvitkine avatar asvitkine commented on June 15, 2024

Another example if WW2 Global 2nd ed, bringing up the battle calc on UK should show both UK and French units.

from triplea.

asvitkine avatar asvitkine commented on June 15, 2024

So before #9602, the logic was:

  • Take the player list, ordered by number of units, except putting the current player first in the list if they have units there
  • If not water, set location owner as defender and choose first player in list that the defender is at war with

I'll have to read the details of that PR to understand what it was trying to achieve to understand why there was a logic change in the first place.

from triplea.

asvitkine avatar asvitkine commented on June 15, 2024

@DanVanAtta wondering if you agree that given the above, we shouldn't actually do "the attacker is always the current player" logic, given you're the one who suggested that on the above PR.

from triplea.

asvitkine avatar asvitkine commented on June 15, 2024

Ok, so let me try to document some cases that I think don't work as they should in 2.6:

WW2 Global 1940 2nd Ed:
a. Germany's turn, open battle calc on Northern Italy (ally)
Expected: Battle calc prepopulated with defending units of Italy
b. Germany's turn, open battle calc on sea zone with Italian ships (ally)
Expected: Battle calc prepopulated with defending units of Italy
c. Germany's turn, open battle calc on a Russian territory (currently Neutral)
Expected: Battle calc prepopulated with defending units of Russia

Let me see if I can set these up as test cases when working on a fix.

from triplea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.