Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2001:
[Freeciv-Dev] Re: chance of winning a battle
Home

[Freeciv-Dev] Re: chance of winning a battle

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: chance of winning a battle
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Date: Mon, 16 Jul 2001 00:59:21 -0700 (PDT)

On Sun, 15 Jul 2001, Gregory Berkolaiko wrote:
> Aha, so now I find that "statistically exact function" calculating the
> chance of winning in a battle has been written long time ago by Trent,
> edited and incorporated as win_chance by Thue (I believe) and is used

All Thue did was change variable names, add a few bugs, and make it slower. 
Probably another case of "Not Invented Here" syndrome.

> 2. There is a dormant mistake in win_chance.  Line 39 of combat.c should
> be 
> int def_N_lose = (dhp+afp-1)/afp;

This was in my original code.  Thue needed to change it, so he could pretend
it was his code and not mine, so he added this bug.  The funny thing is you
will probably get credit for fixing this bug, more credit than I got for
writing the code without bugs to begin with!  But certain people were never
very good and giving credit where credit is due.

He also removed the optimization that you can find the probability of either
the attacker or defender winning, whichever is faster.  If the defender needs
to win fewer rounds, find the probability of him winning and just subtract it
from 1.

I also handled the case where either the attacker or defender has a strength
of 0.



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