averbraeck / housinggame-player

Player app for the housing game
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Paid debt needs to be calculated correctly #39

Closed averbraeck closed 10 months ago

averbraeck commented 10 months ago

At the start of a round, the paid debt is calculated, but that has to be done correctly (not more than money available, not more than needed to cancel debt).

averbraeck commented 10 months ago

The correct formula is:

newPr.setPaidDebt(Math.max(0, Math.min(0, newPr.getSpendableIncome()) - oldPr.getSpendableIncome()));
averbraeck commented 10 months ago

Updated.

averbraeck commented 10 months ago

Check that the calculation is correct:

image