Optimal retry calculation for game

17 Views Asked by At

I am playing a game where I have stamina accumulated to damage an enemy. There is the possibility to test attacks and determine my average damage. When attacking outside of test mode it costs 48 stamina, retrying an attack results in no damage and costs 4 stamina. When under 48 stamina, no more attacks are possible. I am trying to get the optimal damage range where I should let the attack count and under which value I should retry. From my understanding, the amount of stamina left should influence the treshold, but I have too little of an understanding of statistics and math to figure out how to do this. In the end, I want to create a formula which inputs stamina left after each attack and takes the average damage from test runs to know if I should retry or not. I appreciate any help, thanks in advance!