## Possible EV bug with Horsemen

**Moderators:** Forum Moderators, Developers

**Forum rules**

Before reporting issues in this section, you

**must**read the following topic:

### Possible EV bug with Horsemen

I was doing some EV tests on 1.8.6 and although all my other units were estimated as the correct % of their dmg output Horsemen seem to be calculating incorrectly.

Here is my example:

Horseman dmg output is 20-2 at day vs a thunderer in shallow water so it has 80% chance to hit

normally EV would say for other units its 80% of the 40 possible dmg is the EV which is 32 but for some reason the game is only expecting 26.9

my skirm with 5-4 dmg output at 80% is correctly estimated at 16 dmg

my spearman with 7-3 dmg output at 80% is correctly estimated at 16.8 dmg

im wondering if it has to do with the calculations the game has to make when it factors in tod, resistance, and the double dmg of charge?

Here is my example:

Horseman dmg output is 20-2 at day vs a thunderer in shallow water so it has 80% chance to hit

normally EV would say for other units its 80% of the 40 possible dmg is the EV which is 32 but for some reason the game is only expecting 26.9

my skirm with 5-4 dmg output at 80% is correctly estimated at 16 dmg

my spearman with 7-3 dmg output at 80% is correctly estimated at 16.8 dmg

im wondering if it has to do with the calculations the game has to make when it factors in tod, resistance, and the double dmg of charge?

"There's no love in fear." - Maynard James Keenan

I'm the guy who's responsible for 40% Gliders in all hexes... I can now die a happy man. =D

I'm the guy who's responsible for 40% Gliders in all hexes... I can now die a happy man. =D

### Re: Possible EV bug with Horsemen

The Thunderer doesn't have as much as 40 health, so you can't do 40 damage. The horseman's first attack should have an expected damage of 16. The second attack has a lower expected damage, since if the first attack hit the thunderer has less than 20 health remaining.

### Re: Possible EV bug with Horsemen

Lol Cackfiend, you put it me very easy

tekelili wrote:I understand why this happen, it is due that 2nd cav could kill griphon if 3/3, but I wouldnt have dealt 27 dmg, because griphon has 24 hp

Cackfiend wrote:so was this the thread where tekelili finally realized how EV works in wesnoth?

Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.

World Conquest II

World Conquest II

### Re: Possible EV bug with Horsemen

Well the thunderer had 32 hps. With the way you're saying it works is that the game would expect 80% of 20 dmg to land on the first hit since the unit has full hps so thats 16. The second attack the unit only has 12 hps which I guess you're saying the game expect to only do 80% of that? that would be 9.6 which added together with the 16 EV equals to 25.6 so where did the game get the EV of 26.9?Scatha wrote:The Thunderer doesn't have as much as 40 health, so you can't do 40 damage. The horseman's first attack should have an expected damage of 16. The second attack has a lower expected damage, since if the first attack hit the thunderer has less than 20 health remaining.

I still think its a bug

hehe I knew you would bring this up actuallytekelili wrote:Lol Cackfiend, you put it me very easytekelili wrote:I understand why this happen, it is due that 2nd cav could kill griphon if 3/3, but I wouldnt have dealt 27 dmg, because griphon has 24 hpCackfiend wrote:so was this the thread where tekelili finally realized how EV works in wesnoth?

touche sir, but I have a firm grasp of how EV is calculated in the game , i just think I may have found a bug exclusively with horsemen

"There's no love in fear." - Maynard James Keenan

I'm the guy who's responsible for 40% Gliders in all hexes... I can now die a happy man. =D

I'm the guy who's responsible for 40% Gliders in all hexes... I can now die a happy man. =D

### Re: Possible EV bug with Horsemen

Make sure to consider the complete table of possible results. That is the following:Cackfiend wrote:Well the thunderer had 32 hps. With the way you're saying it works is that the game would expect 80% of 20 dmg to land on the first hit since the unit has full hps so thats 16. The second attack the unit only has 12 hps which I guess you're saying the game expect to only do 80% of that? that would be 9.6 which added together with the 16 EV equals to 25.6 so where did the game get the EV of 26.9?Scatha wrote:The Thunderer doesn't have as much as 40 health, so you can't do 40 damage. The horseman's first attack should have an expected damage of 16. The second attack has a lower expected damage, since if the first attack hit the thunderer has less than 20 health remaining.

I still think its a bug

* No hits in both tries. (0 dmg)

* A hit in the first but no hit in the 2nd try. (20 dmg)

* No hit in the first strike but one in the 2nd. (20 dmg)

* Hitting in both, the first and the 2nd strike. (32 dmg)

You have to do the calculations for each of those, consider the resulting damage (also depending on how many HP are still left) and weight the damage based on the probability for the results. Yes, this is one of those cases where order does matter...

### Re: Possible EV bug with Horsemen

still dont see why the game expects an EV for 26.9, someone explain it to me?

"There's no love in fear." - Maynard James Keenan

I'm the guy who's responsible for 40% Gliders in all hexes... I can now die a happy man. =D

I'm the guy who's responsible for 40% Gliders in all hexes... I can now die a happy man. =D

### Re: Possible EV bug with Horsemen

ivanovic wrote:Make sure to consider the complete table of possible results. That is the following:

* No hits in both tries. (0 dmg)

* A hit in the first but no hit in the 2nd try. (20 dmg)

* No hit in the first strike but one in the 2nd. (20 dmg)

* Hitting in both, the first and the 2nd strike. (32 dmg)

Code: Select all

```
first | second | probability | damage
----------------------------------------------------------
miss miss 0.2 x 0.2 = 0.04 0.04 x 0 = 0
hit miss 0.2 x 0.8 = 0.16 0.16 x 20 = 3.2
miss hit 0.8 x 0.2 = 0.16 0.16 x 20 = 3.2
hit hit 0.8 x 0.8 = 0.64 0.64 x 32 = 20.48
===========================================================
sum 1 (100%) 26.88
```