twanvl / hearthstone-battlegrounds-simulator

A simulator for battles in the Hearthstone Battlegrounds
MIT License
51 stars 12 forks source link

"damage dealt" calculation is wrong #2

Closed malcolmsharpe closed 5 years ago

malcolmsharpe commented 5 years ago

This input:

Board
level 1
health 30
* Amalgam
Vs
level 2
health 30
* Amalgam
* Amalgam

Produces:

--------------------------------
win: 0%, tie: 0%, lose: 100%
mean score: -1, median score: -1
percentiles: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 
mean damage taken: 3
expected health afterwards: 27, 0% chance to die
mean damage dealt: 2
expected enemy health afterwards: 28, 0% chance they die
--------------------------------

I would expect:

--------------------------------
win: 0%, tie: 0%, lose: 100%
mean score: -1, median score: -1
percentiles: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 
mean damage taken: 3
expected health afterwards: 27, 0% chance to die
mean damage dealt: 0
expected enemy health afterwards: 30, 0% chance they die
--------------------------------

As a reverse, consider:

Board
level 1
health 30
* Amalgam
* Amalgam
Vs
level 2
health 30
* Amalgam

This produces:

--------------------------------
win: 100%, tie: 0%, lose: 0%
mean score: 1, median score: 1
percentiles: 1 1 1 1 1 1 1 1 1 1 1 
mean damage taken: 0
expected health afterwards: 30, 0% chance to die
mean damage dealt: 0
expected enemy health afterwards: 30, 0% chance they die
--------------------------------

I would expect:

--------------------------------
win: 100%, tie: 0%, lose: 0%
mean score: 1, median score: 1
percentiles: 1 1 1 1 1 1 1 1 1 1 1 
mean damage taken: 0
expected health afterwards: 30, 0% chance to die
mean damage dealt: 2
expected enemy health afterwards: 28, 0% chance they die
--------------------------------

I guess that the "damage dealt" calculation is incorrectly using your opponent's final board instead of your own.

twanvl commented 5 years ago

You are right, the damage dealt calculation was using the the wrong side of the board half the time. It is now fixed (I'll upload a fixed compiled version later today)