## taterchimp says:

## Raging Chart On: A Tale of Two Swords

// Submitted @6:52 AMon 11.11.2013

So a while ago, I was browsing some site on the internet, probably pornagrophy of some sort. I guess I must have become side tracked, because I encountered a hypothetical videogame situation: after slaying 1000 hyperdemons, you have been given a choice of rewards. You can either select the Red Sword, or the Blue Sword. The red and blue sword both deal the same amount of damage, but here is the catch: the Red sword hits 100% of the time, Blue hits 50% of the time but can attack twice as often. Which sword do you take, and why?

Now, obviously, this situation has 3 choices:

A. The Nihilist Approach - “it doesn’t matter which one I take”

This seems like it should be obvious, right? After all, you just have to do some basic math in order to come to this conclusion. Lets say both swords do five damage. In 100 attacks with the red sword, I will do 500 damage, and with the blue sword I get half of 200 attacks by five, for - wait for it - 500 damage. So, as long as its better than my other gear, my choice, much like every choice in life, has no meaningful impact.

B. TeamRed- “I have terrible luck”

Yes, you nihilist, on paper, given a large amount of trials, the two will be equal. But this sword relies on a RNG when it decides to hit. This means that in theory I could miss more than I hit with the blue sword, because this stupid game is rigged! If I pick the red sword, I am guaranteed my 500 damage. The blue sword is eventually going to fail me if I take it, it is only a matter of time.

C. TeamBlue- - “Maaaaaaybe”

There are a lot of maybes in the game. Maybe an enemy dodges. Maybe I get lucky. Maybe I crit! Maybe I can buff the sword! (For the purposes of discussion, neither of these are true. Sorry.) Bummer...well, at any rate, maybe every once in a while I can get really lucky and do some serious damage.

D. None of the Above

Wait...what? How did you….nevermind. You know what? You have to re-choose. House rules.

So which option would you end up picking? From what I saw, it was about 40/50/10 between A B and C. What would I pick? Well, the answer depends a lot on two different things: Statistics and context. Lets look at the former first.

If the odds of the blue sword hitting are forced to be 50%, then anyone who picked A would be correct in that it doesn’t make a difference. But if we assume that the RNG behind the scenes runs an independent check before the next number, that means that a series of coin flips will be normally distributed. However, because a coin only has 2 outputs, a graph of that looks pretty darn lame:

So lame, in fact, I'm not even giving it real data

Where it gets interesting though, is when you perform multiple trials of multiple coin flips. So, for example, lets say you expected to be able to survive 100 turns against a monster. That means that you get 100 coin flips throughout the course of the battle. And you could say that you will fight, for the purpose of example, 500 encounters. Some encounters will result in more hits landing, some will result in less hits landing. But what is neat, is the pattern that these observations create. Because all the coin flips were independent, we expect them to fall in to a normal distribution, along a bell curve.

Oh sweet Jesus, normal distribution.

This is where things get amazing! Because bell curves have already been analyzed to death, I don’t have to do any dirty work, and can just spit out numbers from any statistics textbook and/or website! The average for this curve, based off 100 coin flips, is going to be at the center with a value of 50. The chart can be broken down by standard deviations to figure out what percent of the area is made up by what values. If we know the standard deviation of the data, we can figure out how much area is under each section of the curve, and so, how unlikely it would be to see that value come up. As it turns out, for 100 random trials the standard deviation would be somewhere in the ballpark of 5. For the first 5 in either direction from the median, we cover 34% of the area under the curve, because math. Neat stuff, right? (You can say no...I don't mind...but I think its neat)

So how does this affect our two swords? Well, it means that there is only a 32% chance for us to be outside of 1 standard deviation of hits, so either above 55 and below 45. It also means that there is only a .26% chance of being outside of the 45 to 65 range. In fact, out of 10,000 simulated trials done in excel, only 360 were outside of +/- 10 from the average, as we would expect with the math.

So with that somewhat explained, how does it apply to the situation at hand? First, you would need to know how many rounds you have against each monster, and how much health they have. Then, you have to figure out your level of risk. So assuming that we are only fighting monsters that kill us at exactly at our previously selected arbitrary limit of 100 turns. If they have 500 health, in the long run, it doesn’t matter which sword we pick... but half the time, we will probably die. Not looking great for the blue sword. It can take out enemies with 45 health 85% of the time, though, but that is nothing compared to Red’s 100% win rate!

...but what happens if a monster has 505 health? Red’s win rate drops to 0%, while Blue’s is just barely under 50 percent. Suddenly, we made up a ton of ground. Or if we have to deal the same damage within a shorter time limit? Again, Red suddenly has no choice but to resign to never beat the game without better gear, whereas Blue can suddenly begin to shine. In fact, if we had infinite time, we could kill a monster that has a full 1000 health! It would be like winning the lottery while getting eaten by a rabid shark that was just struck by lightning, but theoretically...it could happen!

Maybe just as likely as seeing this exact arrangement of cards

Now, you won’t always get 100 rounds against your opponent, which affects some of these numbers. As the number of rounds increase, the effect of the variance decreases thanks to the Law of Large Numbers. This means that as the number of turns decrease, the variability is more pronounced. So lets look at what happens with ten turns instead of 100. The average damage is still where we would expect it to be at 5, but the standard deviation changes to be 1.5. This means that our 68% is now within 3.5 to 6.5, and our .26% is now at .5 to 9.5. Suddenly, it doesn’t look like quite the best option yet.

Now here is one final thing to consider about the two swords, and is something that I have yet to mentally reconcile, to be honest. If you have 2 attacks at 50% to hit, the expected result would be that, on average, 1 attack hits each time. But consider this: each turn has 4 possible outcomes, each with equal odds of happening: both miss, only the first hits, only the second hits, or both hits. 3 of the 4 outcomes are equal to or better than the Red sword, so you have 3:1 odds of Blue being the same or better!

But ultimately, math cannot make this decision. In the end, you have to go with your gut as to what ‘feels’ the best, and a lot is to be said for the context. However, I hope that this has helped in your consideration when encountering similar scenarios. Or at least you’ll have an ethos.

Popular community blogs may get promoted to the home page.

follow |

`[*].disqus.com`

to your security software's whitelist.Back to Top