Skip to content

2021-September-10 - Prerelease - 2.6.366

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 10 Sep 06:22
a313839
Battle Simulator: Use library to calculate mean (#9585)

* AggregateResults: Reorder functions

* AggregateResults: make "get average" methods public

Declare all the "get average" methods as public.  Prior some where and
some where package protected.

* Use external math library to calculate mean

Instead of calculating the mean "by hand", use a math library which does
it for us.

* Battle Calculator: Return NaN if no results were aggregated

Let the methods of AggregateResults return NaN if no results were
added to that instance. Previously, 0 was returned which is equally
arbitrary.

Note that all call sides from the AI ensure that results are added
or they don't call methods like ...IfAttackerWon() where its possible
that no results remain to calculate the mean on.

* Battle Calculator: Display N/A instead of NaN to the user

* Battle Calculator: Add NaN test

Test AggregateResults to return NaN when no results were added.  This is to
ensure that in the future if the convention for the return value in case of no
battle results is changed also the call sides are considered.