# Add to the stats dialog number of hits stats (actual/expected) #4066

Open
opened this issue May 9, 2019 · 5 comments

Projects
None yet
2 participants
Member

### jostephd commented May 9, 2019

 See https://forums.wesnoth.org/viewtopic.php?f=12&t=49785. I'm considering adding one line to the stats dialog, showing total number of hits / expected number of hits. After 1 hit at 60%, 3 hits at 70%, and 1 miss at 70%, the total number of hits is 4 (= 1+3) and the expected number of hits is 3.4 (= 1*0.6 + 4*0.7), so the line would say "4 / 3.4". The thread discusses also showing the confidence interval, or standard deviation, or the a priori probability of the actual result, but I'm not sure I'll be adding any of these in the first revision.

Member Author

### jostephd commented May 9, 2019

 Here's what it looks like: In this case, I had a Mage and a Thunderer attack a unit that had 40% terrain defense. The expected number of hits in this case is `3*0.7 + 1*0.6 = 2.7`. The actual number of hits was 2 (that's what the RNG decided in this playthrough). 39.2% is the probability of getting 2 hits or fewer in these two attacks: ``````>>> mage = 0.7 >>> dwarf = 0.6 >>> (1-mage) * (1-mage) * (1-mage) * (1-dwarf) + (1-mage) * (1-mage) * (1-mage) * dwarf + 3 * mage * (1-mage) * (1-mage) * (1-dwarf) + 3 * mage * mage * (1-mage) * (1-dwarf) + 3 * mage * (1-mage) * (1-mage) * dwarf 0.3924 `````` Any comments?

Open

Member

### Pentarctagon commented May 10, 2019

 Would there be some way to indicate to the user that the two sets of Inflicted/Taken rows count things different ways? Unless I'm mis-remembering, the top Inflicted is how much damage should have been inflicted just by the current player, whereas the bottom Inflicted will count the number of hits across all players' units.
Member Author

### jostephd commented May 10, 2019

 The bottom Inflicted should show only the current player's hits. See https://github.com/wesnoth/wesnoth/pull/4070/files?file-filters%5B%5D=.cpp#diff-56105e5f707d8c63e0f6cf0582a7e22fR537 and below.
Member

### Pentarctagon commented May 10, 2019 • edited

 Ah, I misread - I thought it said that the mage and thunderer attacked each other. Otherwise, I'd say to use some other separator than `/`. I can imagine there being a fair number of people confused about how 2 divided by 2.7 somehow ends up at 39%. Maybe display it as `2 (2.7)` instead? 17/25.2 is at least fairly straight forward as to how they are related to the -32%.
Member Author

### jostephd commented May 10, 2019

 Good point, made a note on the PR so I don't forget it