Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] Re: TODO
Home

[Freeciv-Dev] Re: TODO

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: TODO
From: Thue <thue@xxxxxxx>
Date: Sun, 24 Sep 2000 22:35:21 +0200
Reply-to: thue@xxxxxxx

On Sun, 24 Sep 2000 22:03:41 Trent Piepho wrote:
> On Sun, 24 Sep 2000, Thue wrote:
> > > > +- Create a function that gives a statistically excact value for a
units
> > > > +  chance of winning a battle.
> > > 
> > > I wrote a perl version once:
> > >   http://www.mso.anu.edu.au/~dwp/freeciv/misc/fc_combat_odds.pl
> > > -- David
> > 
> > I converted it to C, but haven't yet freecivisized it. I wanted to
understand
> > it, so the comments have a full formal proff of it's correctness...
> > Hopefully I will find the time to merge it into freeciv some time; I have
some
> > other usefull combat calculation code to also include.
> 
> This is something I wrote to do the exactly same thing, when I worked on
> freeciv like 2 years ago.  It's a much better algorithm than you've used. 
Of
> course, do to NIH syndrome, you'll probably do things to stupid way.  Or
> someone will change a variable so they can claim they wrote it.

"NIH"? Anyway, yes, it is a better algoritm.
But there us a small error on the line
        p=sum_binomial(p,dhp/afp,ahp/dfp);
It should be
        p=sum_binomial(p,dhp/afp + dhp%afp,ahp/dfp + ahp%dfp);

(still trying to understand the exact code in sum_binomial, though I appreciate
the principle)
        double q=1-p;
        double r,b,s;
        int n=x+y-1,k;
Say, you didn't work on the freeciv AI? :)

-Thue



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