There was a bit of math that I couldn’t figure out in Hearthstone. I needed an equation not an answer to a situation where I dealt fatigue damage to face. So I needed an equation that showed the sum of consecutive numbers that doesn’t always start with zero. Originally I wondered what that equation would be for 8 consecutive numbers. Here is the equation that my math whiz friend knew about.
X+X+1+X+2+X+3+X+4+X+5+X+6+X+7= 8x+28
This beauty of this is that you can figure out whatever your combo is and write that out whether it is 2 or 9.
It's usually simpler to do the multiplication rather than the squaring in your head (for me anyway).
Easiest in head way is probably: write down N and N+1. Halve the even one and multiply that by the odd one.
But OP did ask for sums not starting at 0 (which is 1 effectively ;) ) for which 2 equivalent answers were given.
Gauss apparently came up with this formula when he was 10 years old on the way up the stairs to work on the problem his dad gave him (sum the numbers from 1 to 100), reasoning was: 1 + 100 is 101, 2 + 99 is 101 too, there are 50 pairs, therefore 50 * 101 = 5050. (Or as Gauss would have been thinking, eins plus hundert ist hundert und eins, zwei plus neun und neunzig ist hundert und eins auch, es gibt funfzig paare, so die antwort ist funf tausend und funfzig).
I remember there was a formula from Ryzen's stream (pro player that used to play A LOT of mill rogue back when it was viable). It was pretty short and simple.
Public static int Fatigue(Int HP, Int Turn) { If(HP>0) Return HP; HP-=Turn; Fatigue(HP,Turn+1); } Any Computer Scientist out there??
I used to program playstation games and have a degree in maths ;)
That function just returns HP unless HP <= 0, so I don't know what you are getting at there. Maybe it would work if HP was a class member variable and not a parameter ;) EDIT: and you made it so it did something that was correct lol.
A recursive solution is usually bad if a closed form (formula you can plug numbers into) exists... which has been given 3 times already...
You made me realize that I don't even have a return method-_- EDIT: I'm just being fancy using recursion most of the time I hate doing things recursively I also got HP backwards I believe
I needed a quick way to calculate who between the 2 players gonna receive lethal from fatigue first, so I did an "equation"; I ask if someone can put my calculation in a correct form.
The calculation will find the DMG difference between player 1 and player 2 in this way: (n° of player1 deck's card - n° of player2 deck's card) * n° of fatigue draw) . Example: p1 has 3 card remaining and p2 has 2 cards remaining, p1 play Brann + 2xColdlight Oracle, meaning that the total amount of fatigue draw is 6 for p2; (3-2)*6 = 6 meaning that p2 get 21 damage while p1 get 15.
So the equation I did is: (y - z ) * x . But I feel there is a better way to express it.
Rollback Post to RevisionRollBack
Follow on Twitter for news, meta analysis and funny Hearthstone related stuff!
To post a comment, please login or register a new account.
Fatigue math
There was a bit of math that I couldn’t figure out in Hearthstone. I needed an equation not an answer to a situation where I dealt fatigue damage to face. So I needed an equation that showed the sum of consecutive numbers that doesn’t always start with zero. Originally I wondered what that equation would be for 8 consecutive numbers. Here is the equation that my math whiz friend knew about.
X+X+1+X+2+X+3+X+4+X+5+X+6+X+7= 8x+28
This beauty of this is that you can figure out whatever your combo is and write that out whether it is 2 or 9.
Violet Illusionist+Coldlight Oracle+ Brann Bronzebeard
Dedicated to all those who embrace math and see it everywhere. Thank You.
sum(1 to n) = n(n+1)/2
sum(a to n) = sum(1 to n) - sum(1 to a-1) = n(n+1)/2 - (a-1)a/2
first_number + first_number+1 + ... + last_number-1 + last_number = (first_number + last_number) * quantity_of_numbers / 2
For example:
Counting fatigue damage from 1 to 8: (1+8)*8/2 = 9*4 = 36
Yes, both answers give the same formula after rearranging and factorising.
sum(a to n) = (n+a)(n-a+1)/2
Thread of the month!
imo
I remember there was a formula from Ryzen's stream (pro player that used to play A LOT of mill rogue back when it was viable). It was pretty short and simple.
Fuck cubelock
Post #2, #3 and #7 gave the correct formula, just rearranged differently...
Fatigue(30,0);
Public static int Fatigue(Int HP, Int Turn)
{
If(HP>0)
Return HP;
HP-=Turn;
Fatigue(HP,Turn+1);
}
Any Computer Scientist out there??
Soul Parade :)
You made me realize that I don't even have a return method-_- EDIT: I'm just being fancy using recursion most of the time I hate doing things recursively I also got HP backwards I believe
Soul Parade :)
I needed a quick way to calculate who between the 2 players gonna receive lethal from fatigue first, so I did an "equation"; I ask if someone can put my calculation in a correct form.
The calculation will find the DMG difference between player 1 and player 2 in this way: (n° of player1 deck's card - n° of player2 deck's card) * n° of fatigue draw) . Example: p1 has 3 card remaining and p2 has 2 cards remaining, p1 play Brann + 2xColdlight Oracle, meaning that the total amount of fatigue draw is 6 for p2; (3-2)*6 = 6 meaning that p2 get 21 damage while p1 get 15.
So the equation I did is: (y - z ) * x . But I feel there is a better way to express it.
Follow on Twitter for news, meta analysis and funny Hearthstone related stuff!