wesnoth-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-dev] EV calculations


From: ott
Subject: [Wesnoth-dev] EV calculations
Date: Wed, 10 Aug 2005 14:00:36 +0200
User-agent: Mutt/1.5.6i

Looking at the code, it seems to me that the reason people have been
continually complaining about expected value (EV) damage values is that
these values are simply wrong.

The EV statistics are stored as integers, and truncation is done on
each swing.  So an Elvish Fighter doing 5-4 with 50% to hit, will have
its EV of damage dealt calculated as 5*.5 = 2.5 = 2, four times, ie. it
will come out at 8 total, instead of the actual value of 10.

The simplest way I thought of fixing this bug is through the attached code
(compiled OK but not tested in actual play).  This tries to compensate
for the truncation by randomly adding 1 to the result based on the size
of the discarded fraction.  This estimator should approximate the true
EV as the number of swings grows; its expected value is the actual EV.
A better approach would be to keep an integer fraction as well as the
integer EV, or to keep the EV as a floating point number, but this would
clearly be a post-1.0 solution.

However, this code would mean we suddenly start using rand() quite often.
Is this likely to have any ill effects -- are we relying on a particular
sequence of random values to be repeatable given the seed, or will we
suddenly need a better random number generator due to subgroup effects?
And, most important of all, would this fix break the feature freeze?

-- address@hidden

Attachment: ev.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]