I found problems with the battle odds calculations.
In game 4246, twice I sent 2 pikemen to attack a city with a heavy infantry and +5 walls. The first time, on turn 8, the computed odds were 68.5%. I lost. The 2nd time, on turn 10, the odds were 71.4%, and I won. Should have been the same odds both times, wouldn't you say?
I worked out what the odds should be myself, and I got 68.6%. Below is the math.
According to the docs, damage is only done if one unit hits and the other misses. For a 15 str unit to hit a 20 str, it has to roll a hit (15% chance), and the other must miss (80% chance).
Chance of 15 str unit hitting = 0.15*0.8 = 0.12
Chance of 20 str unit hitting = 0.2*0.85 = 0.17
Chance of 1 hit occuring = 0.12+0.17 = 0.29
(Chance of both missing = 0.68, chance of both hitting = 0.03)
Since 0.71 of the probability is discarded, the real odds are 0.12/0.29 and 0.17/0.29, for 0.4138 and 0.5862 respectively.
The chance of 1 20 str unit beating 2 15 str units is the chance that it gets 4 hits in a row:
0.5862 ^ 4 = 0.1180874
Plus the chance that it suffers 1 hit somewhere between the 4 hits it gets. There are 4 ways that can happen (5 total hits delivered, any of the 1st 4 can be the hit it takes. Can't be the last hit.)
0.1180874 * 0.4138 * 4 = 0.195455
Just add the chances of these 2 mutually exclusive possibilities together:
0.1180874 + 0.195455 = 0.313542
1 - 0.3135 = 0.686458. That's a 68.6% chance that the 2 15 str units will win.