Complete.Org: Mailing Lists: Archives: freeciv-ai: April 2002: [freeciv-ai] Re: Approximate win_chance

# [freeciv-ai] Re: Approximate win_chance

[Top] [All Lists]

 To: Raahul Kumar Cc: Gregory Berkolaiko , freeciv-ai@xxxxxxxxxxx Subject: [freeciv-ai] Re: Approximate win_chance From: "Ross W. Wetmore" Date: Fri, 19 Apr 2002 15:32:34 -0400

```At 06:54 PM 02/04/18 -0700, Raahul Kumar wrote:
>
>--- Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx> wrote:
><snip>
>
>I like your approximation better than the current system. You have me
convinced

Me too.

Enough precision is necessary, but it is necessary it be only enough.

>> fix the problem of absolute error sometimes being 15%. You should have
>> mentioned how often those values crop up.
>>
>> Power 5 works best (better than 4 or 6).  Not very often.  You can
>> experiment with the code I attached.
>
>That's what I don't understand. I assume higher powers should always work
>better. More precision, less errors. Yet your results show differently. I am
>suspicious. I demand an explanation.

One think to ask is does the error happen in lopsided battles, or is it
occurring in cases of near equivalence. A 15% error in a 1 in a million
chance of winning can probably be ignored. But the difference between a
85% or 115% chance of winning might significantly alter choices.

>> This performs way better but for some weird cases it still gives an
>> absolute error of about 15%.
>>
>> Is there any way we can avoid calling approx win_chance when that happens?
>>
>> The problem is that I don't know beforehand when such thing would happen.
>> But I am still thinking about it...
>
>There must be a range of some weird values.

The approximate win_chance is a continuous function. But if you do it
by explicit calculation, then units within a range of hp values will
all have the same chance of winning since hp is lost in fp discrete
units. The real function should be a sawtooth version of the smooth
plot with errors corresponding to the difference between the lower hp
value which it takes to survive into the next round and the real hp.

First try reducing hp values to modulo fp for the approximate function.
Then look to see if the percentage hit is further affecting this.

>Aloha,
>RK.
>
>It is not the mountain we conquer but ourselves. -Sir Edmund Hillary
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Tax Center - online filing with TurboTax
>http://taxes.yahoo.com/

Cheers,
RossW
=====

```