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

[freeciv-ai] Re: Approximate win_chance

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: Approximate win_chance
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Fri, 19 Apr 2002 12:57:11 +0100 (BST)

On Thu, 18 Apr 2002, Raahul Kumar wrote:

> > 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.

I have no explanation.  This is the way things are.  In principle it is 
possible to play with the win_chance formula (which is essentially 
hypergeometric function) and maybe do some expansions and show why 5 is 
the best, but I'm not interested in doing it.

> > 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. 

There is.  It seems that th biggest errors arise when the attacker is very 
strong but low on hitpoints (also can happen when attacker is strong and 
very high on hitpoints, around 50, but maximum in the defaut ruleset is 
40).  So I intorduced some correction for this situation, which brings 
number of mistakes greater than 10% from
        131 out of 7680
to
        11  out of 7680
(and even those mistakes do not exceed 11.07%).

The code is attached.  You can play with CORRECTION and ERROR defines.

G.

Attachment: test.c
Description: Text document


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