# Guides/Probability

### From Eternal Lands Wiki

This page intends to provide some basic information on how the mathematics behind Eternal Lands basically work, what probability certain event have, say make an enriched essence in a certain number of essences, and what to expect when playing. We aim to skip the unnecessary stuff and present the results with some hopefully helpful examples.

## Contents |

## Basic considerations

There underlying problem in determining probabilities and related values is classically an Urn problem: Let's say, the chance for an item to break is 1 in 300 (uses, hits). Imagine an urn with 299 white marbles and 1 black marble. Take a marble from the urn, look at it and put it back in. Now, the chance to pick the black marble is obviously 1 in 300, thus the urn models our problem.

The Eternal Lands server does exactly the same thing as picking up a marble, looking at it and putting in back when determining if your item breaks during this use/hit. Of course, the server doesn't need the visual aid, a 5% chance (5 in 100 equals 1 in 20) is computed like this

if(my_rand(19)==2)

according to Entropy (please note that the above link talks of a 5% chance for a 20 instead of 19, however Entropy corrects himself later in the same thread, this is due to the fact that the zero is included, making 0..19 20 numbers), this checks if a randomly generated number equals 2 (the black marble).

Now, you'll probably want to use your items more than once which leads us to the next section:

## Trying fate *n* times

First off: *n* stands for a natural number, such as 1,2,3,4,... and so on. Another common abbreviation in probability theory is to denote the chance of success with *p* and the chance to fail (no success) with *q*, obviously

q = 1 - p.

When you think of break rates you might not want to call your items breaking a success, so just think of *p* as the chance for an event to happen instead. The important part is that there's only two possible outcomes like in the example with the marbles above.

Now imagine that you're repeating the example above with the marbles a couple of times, say 3 times of picking up a marble, looking at it and putting it back. The chance to draw the black marble is 1 in 300 (p=1/300, q=299/300), you can get the following results (w=white, b=black):

(w,w,w), (w,w,b), (w,b,w), (b,w,w), (w,b,b), (b,w,b), (b,b,w), (b,b,b).

Obviously we'd expect (w,w,w) most of the time with a probability of (299/300) to the power of 3, but this highlights another problem:

When looking at break rates, do we want to know the probability for our items to break at a certain time or do we want to know how many spare items to buy or bring? Now, the first option certainly has interesting applications (say 2 EFEs right after another?) but mostly we'll be concerned with the second option.

### I don't care when but *k* in *n*

where *k* is another natural number, less or equal to *n*. In the example above we find 3 possible ways to get a series of colored marbles with one black and two white marbles (we don't really get to see it as we have to put the marbles back), each of them has the chance of (299/300)(299/300)(1/300), so the probability to get one of those series is 3 times that. Now remember, we had p = 1/300 and q = 299/300, so we can write the probability as

3 * p^1 * q^2.

The general case, to make a long story short, looks like this

( (n!)/(k!(n-k)!) ) * p^k q^(n-k),

where the first term is the binomial coefficient of *n* and *k*.

We can now use the above formula to calculate what to expect in theory. In probability theory there's a so called expected value, that tells us what we should expect from an experiment "on average". The expected value while rolling a regular die is 3.5 by the way, even though you will never actually roll a 3.5 on a regular die. The expected value of the above experiment is

n*p.

In our example with the marbles this means that if we made a new experiment in which we repeated the old experiment 300 times (series of 300 marbles), we can expect to see the black marble once on average in a series. In other words: if you have an item that has a chance to break of 1 in 10k, you should expect it to break in 10k uses/hits.

There's one more value to consider here and that's the variance: it tells us how far spread out we should expect results from the expected value, think of it as a measurement to tell the extremely lucky/unlucky from the regular lucky/unlucky people. For our problem the variance is calculated to

n * p * q.

Putting this to use in our series of 300 marbles example we see that the variance is q (as n*p=1), which means we shouldn't really be expecting to have series with more than 2 black marbles in them (0 is possible of course). However if we did series of 600, we'd expect 2 black marbles per series on average and as much as 4 and as low as 0.

### I don't care how, I had *k* just now

## Profit

### Amount of items from a fixed set of ingredients

Here, we'll look at how many items you can get from a fixed set of ingredients, say for 100 or *n* items if you try until you run out of ingredients.

We're going to calculate this in steps:

- make
*n*attempts to mix the item- get the expected number of items (see expected value above)
- lose the expected number of items

- repeat with the left-over ingredients (from non-critical fails) until there are no more ingredients left.

The expected number of produced items in the first *n* attempts is *n* * p where p is your chance of success,

p = (your level)/(2 * recommended level),

use 99% or some other value from your experience if your level is equal to or higher than 2 times the recommended level. The expected number of critical fails is 1/3 of the remaining ingredients leaving you with 2/3 of (n - n*p) items to attempt in the second run. In this second run we expect to get

2/3 * (n - n*p)*p items,

lose 1/3 of the unsuccessful attempts and have

2/3 of 2/3 * (n - n*p) - 2/3 * (n - n*p)*p = (2/3)^2 * (1 - p)^2 * n

ingredients left, now we see that by induction that after the *k*th repetition of our process we will have (2/3)^k * n * (1-p)^k ingredients left, we will lose 1/3 * (2/3)^(k-1) * n * (1 - p)^k, the total of items made is thus the sum from j=0 to k-1 of (2/3)^j * n * p * (1 - p)^j. The theory of infinite series tells us, that the total of items made after infinite attempts (don't worry, this won't be necessary as there are no fractions of items) you will have

n * p / (1 - (2/3 * (1-p))) items.

See below for examples.

#### Estimate of the necessary attempts

As there are no fractions of items, say a half steel bar, we can abort the infinite series above at a certain *k* and we'll have made

n * p * (1 - (2/3)^k(1 - p)^(k+1)) / (1 - 2/3 * (1 - p)) items.

To determine the step *k* at which to stop, we look for the *k* at which the left over ingredients are less than 1. Above we found that after *k* steps we have (2/3 * (1 - p))^k * n items left, which is less than one if

k > - ln(n)/ln(2/3 * (1 - p)).

The difference between number of attempts up to and including step *k* and *n* tells us how much extra food we'd have to buy if we want to use *n* ingredients. This number is, as it turns out, what we're really after, as we've been working with fractions of items and expected values the whole time and expecting some sort of guaranteed number of items would be neglecting the random nature of the underlying processes.

So, to be on the safe side, always work with conservative numbers here.

To determine the sum of steps taken, we figure that we made *n* attempts in the first round, and we had (2/3 * (1 - p))^k * n items left (k=1) after the *k* step, we attempt to make them in the second round, i.e. after the 2nd round we'll have made n + 2/3 * (1 - p) * n attempts, the same formula that we used above then gives us, that after *k* steps we will have made

n * ((1 - (2/3 * (1 - p))^k ) / (1 - 2/3 * (1 - p)) ) attempts.

Since (1-p)^k tends to zero for large *k* we can simplify the last formula to

n / (1 - 2/3 * (1 - p)) = number of produced items / p.

See below for examples.

## Astrological considerations

We're only interested in the fail and degrade modifiers here, the exact way that the fail modifier works is unknown (to the author at this point). The degrade modifier works as follows: it's added to the "10k base", this means if *dm* is the value of your degrade modifier and the chance for an item to break is *b* in 10k, then the actual chance to break is *b* in (10k+*dm*). If you have the No More Tears Perk (possibly by using the cape) the modified value is multiplied by 4. Now, the degrade modifier varies from -900 to 900, looking at the best case, an item with a break rate of 1 in 10k we see that for those items the difference of 1 in 10k to 1 in 10,900 or 9,100 is not very large (0.01% compared to 0.009% or 0.011%). Looking at a rather bad case, say mortars and pestles, with a chance to break of 1 in 300, so roughly 33 in 10k, comparing the probabilities we see that we'll either break 3 more or less depending on astrology. If you've used mortars and pestles on a "bad day" you will think this unlikely, statistically however it's actually true.

## Other considerations

Keep in mind that the server always adds a small random number to your chances, there is no level where p=1 for anything except for the Magic skill, for all other skills, you will always have to work/calculate with a p<1.

## Examples

- expected result when making Potions of Spirit Restoration from 100 ingredients at level 30: p = 30/40 = 3/4, (2/3) * (1 - p) = 1/6, 100 * (3/4) / (1 - 1/6) = 100 * (3/4) * 6/5 = 90 Potions of Spirit Restoration. Remember, the calculation involved works with expected values and fractions of items, you will most likely get a few less.
- using the above example, how many attempts will we have to make? p = 3/4, n = 100 gives us

k > 2.57

i.e. we should be out of ingredients after 3 rounds.

- Again using the same example the number of attempts necessary to produce the potions is

100 * (0.995/(5/6)) = 120.