Tags

wow (82) real.life (27) mathematics (19) info.tech (13) commerce (10) doomsday (7) runescape (4)

Search This Blog

29 July 2009

There's Something About Lady RNG

Computerised environments intrinsically lack randomness, so a random number generator (RNG) must be used where an unpredictable result is required. In effect, the RNG works on randomly generated data provided to generate a seemingly random number. Since this piece of programming code decides your fate and destiny in WoW in several cases (just like how Fortuna (Lady Luck) decides your fate and destiny in real life), it helps to know a bit about probability!

The golden rule of probability
Probability
is that branch of mathematics that deals with random phenomena to (among other things) determine how likely it will act in a certain way. It is important to know that, for truly random phenomena:
Random does not necessarily mean even or fair!

Simply because it has a chance to happen a certain way does not necessarily mean that it will. Only by observing it an infinite number of times will the observed probability match the theoretic probability.

A certain fundamental formula
What do probability figures mean? They are simply the proportion of the total number of observable events that contain the characteristic in question. This means that:
Probability = Number of events with characteristic ÷ Number of total events

As an example, consider one die from a set of Worn Troll Dice (it has six faces labelled 1 to 6). What is the probability (assuming that it is not loaded) that an even number will be rolled? There are fundamentally six observable events {1,2,3,4,5,6}, with {2,4,6} being even, so:
Probability = 3/6 = 1/2

Enter Lady RNG
How are probability principles relevant to WoW? Simply, they govern the RNG's behaviour. Consider the following scenarios, keeping in mind that Lady RNG can be very fickle!

Getting lucky at the Violet Hold
Of the achievements for Glory of the Hero, Dehydration and A Void Dance are boss-specific ones earned in the Violet Hold. Unfortunately, six of the bosses there spawn randomly, potentially opening vulnerability to unlucky streaks. It then may be interesting to know how often a specific boss will spawn during a run...

First of all, there will be the assumption that each boss has an equal chance to be selected for spawning (lest players become very frustrated!) Then, it would be important to note that once a boss has spawned, it will not spawn again for the rest of the run. There are two random boss spawns during the event, so the chance for any given boss to spawn is 1/6 for the 1st spawn, or 1/5 for the 2nd spawn if they are not selected for the 1st spawn. This information can be summarised in a probability tree:

  • Boss spawns for 1st (1/6)
    • Boss does not spawn for 2nd (1)
  • Boss does not spawn for 1st (5/6)
    • Boss spawns for 2nd (1/5)
    • Boss does not spawn for 2nd (4/5)

To find the probability of taking a particular branch of the tree, simply multiply together the probabilities encountered while progressing down the branch (in accordance with the multiplication rule). Of interest are the two branches involving the boss spawn. Simply add together those probabilities:
Probability = 1/6 × 1 + 5/6 × 1/5 = 1/3
Also, the probability of having the boss not spawn for either window in a single run is 2/3. Those are good odds!

Coin collecting
This meta-achievement requires you to complete A Penny For Your Thoughts, Silver in the City and There's Gold In That There Fountain. That is 52 coins to collect, in order to earn a 53rd.

Consider the case where no coins have been fished up yet. Since more than coins can be fished up from the Dalaran fountain, consider the following conditional probability: given that a coin is fished up on next cast, what is the probability that the coin has not been fished up before? Assuming that there is an equal chance to fish up different coins, there are 52 possible coins that fulfil this criterion, so:
Probability = 52/52 = 1. In other words, it is guaranteed (duh)!

Now that there is one coin in the inventory, what is the probability that the next coin fished up is a new one?
Probability = 51/52. Note that the probability of fishing up new coins has started decreasing.

Say that only one more coin is needed to fish up all 52. What is the probability that the next coin fished up is the one needed to complete the collection?
Probability = 1/52. This is why that final coin is so elusive!

The fabled attack table
Whenever a melee attack is taken from an NPC or another player, whatever happens to it is decided by an attack table:
  1. Miss
  2. Dodge
  3. Parry
  4. Glancing blow (only for NPCs taking player attacks)
  5. Block
  6. Critical hit
  7. Crushing blow (only for players taking NPC attacks)
  8. Ordinary hit

The order means that later outcomes can be considered only if the earlier outcomes were not chosen (by Lady RNG, no less).

In effect, since total percentage is kept at 100% (Lady RNG is firm on that), each outcome's share is adjusted accordingly. Increasing the chance for one outcome subtracts from the chance of the last outcome, which can continue to the point where the last outcome is nudged off the attack table.

Raid-calibre tanks before Patch 3.0.2 gained uncrushability by increasing their dodge, parry and block chances. This had the aspired effect of pushing ordinary hits and crushing blows off the table. As a side note, tanks have a reduced 0.6% chance each to miss, dodge, parry and block, so to reach the 100% mark they needed to stack avoidance to 102.4%.

This is an example of the 'conservation' of probabilities, where the sum of mutually exclusive (not overlapping) and exhaustive probabilities must always equal 1 (or 100%).

Unlucky streaks
Some boss abilities (such as Malygos' Surge of Power) can be cast more than once on the same player. It might be interesting to know the chance that it will be cast on the same player, say, three consecutive times.

A few probability principles will need to be used for this scenario, though the fundamental counting technique will need to be used first. So, since Malygos chooses three players, one of them needs to be said player, and the other two may be anyone else from the raid of 25:
Number of choices = 1 × 24 × 23 = 552

Then, to calculate the number of ways to choose any three players, the concept of combinations will need to be used:
Total number of choices = 25C3 = 2300

The probability for one event must be:
Probability = 552/2300 = 6/25

Since that same event happens three times, the multiplication rule is used for calculating the probability of concern:
Probability = 6/25 × 6/25 × 6/25 = (6/25)3 = 216/15625

What is the chance that the same two people will be Surged all three times? In choosing three players, that specific pair needs to be in it:
Number of choices = 1 × 1 × 23 = 23

The probability in one event involves dividing by the same total number of choices as the preceding case:
Probability = 23/2300 = 1/100

Then, the final probability for a streak of three of these events is:
Probability = (1/100)3 = 1/1000000

EDIT 2Nov09: Appended section on Violet Hold bosses.

No comments:

Post a Comment