This is an archive of the mabination.com forums which were active from 2010 to 2018. You can not register, post or otherwise interact with the site other than browsing the content for historical purposes. The content is provided as-is, from the moment of the last backup taken of the database in 2019. Image and video embeds are disabled on purpose and represented textually since most of those links are dead.
To view other archive projects go to
https://archives.mabination.com
-
wildk wrote on 2013-08-02 14:05
Quote from Paradise;1130722:
if you give initial conditions to use a prob formula, its not a prob formula.
Still, useful post
remember to put a random seed based on a random factor, if not, you will always get a set numbers, since -random()- function is not really random. Its not a good function to use on a program that requires real randomness, unless you put a seed there, and i mean a random seed (sometimes video RAM memory locations are good enough as seeds to get randomness, more if they are checksums).
in other words
[CODE]av_stones, tries = 0, 10000
tries.times do
step, stones = 1, 1
while 1
stones += 1
if step == 0
step = 1
elsif step == 1 or step == 2
rand > 0.5 ? step -= 1 : step += 1
elsif step == 3 or step == 4
rand > 0.45 ? step -= 1 : step += 1
end
break if step == 5
end
av_stones += stones
end
p av_stones/tries[/CODE]
will pretty much repeat the same results, and remember that the generated number has a set max number, which is not setted on this example (maybe just to make the post shorter?)
if im not wrong, not setting the random max, will take the default max range (wich is 10 if i remember well)
in the case of Wildk, its setted to 100, but still, its the default random seed, so as i said, the results will pretty much be the same over time.
Oh derp totally forgot about initial seed >.< still, large scale tests hopefully the result is just about the same
-
Paradise wrote on 2013-08-02 14:20
Quote from wildk;1130732:
Oh derp totally forgot about initial seed >.< still, large scale tests hopefully the result is just about the same
well, just add some coffee to that code xD
coffee never fails, never
[SPOILER="image"]
[Image: http://www.howtogeek.com/geekers/up/sshot50abe2d829619.jpg]
This is how we work on IBM xD[/SPOILER]
-
xi12570 wrote on 2013-08-02 16:40
The problem can be modeled with an absorbing Markov chain with 5 transient states (steps 0-4) and one final state (step 5).
The expected number of stones to reach step 5 is the expected number of steps to absorption.
By the power of Wikipedia:
[CODE]import numpy as np
np.set_printoptions(precision=4, suppress=True, linewidth=1000)
#Initiate transition matrix
P = np.zeros((6,6), np.float64)
P[0,1] = 1
P[1,0] = 0.5
P[1,2] = 0.5
P[2,1] = 0.5
P[2,3] = 0.5
P[3,2] = 0.55
P[3,4] = 0.45
P[4,3] = 0.55
P[4,5] = 0.45
P[5,5] = 1
#Calcutate fundamental matrix
Q = P[:5,:5]
I = np.identity(5)
N = np.linalg.inv(I - Q)
#Calculate expected number of steps
one_v = np.ones((5,1))
t = np.dot(N, one_v)
#Calculate variance on number of steps
var = np.dot((2*N - I), t) - t*t
sd = np.power(var, 0.5)
#Print expected number of transitions from state 0 -> absorption
print "Expected: %f +- %f steps" % (t[0], sd[0])
>>>
Expected: 29.740741 +- 24.708784 steps[/CODE]
Kudos to the people that simulated and got 29-30 ish.
And the expected number is either highly variable... or my code screwed up and everything above is a lie.
-
merrykitten wrote on 2013-08-02 17:18
>Expected: 29.740741 +- 24.708784 steps
huh, i probably shouldn't have used integer division, it's probably the reason why 10000 tries usually yields 29 and not 30
also i suppose that the number should be highly variable
p.s.
yeah, i just tested, the result it usually higher than 29.6
-
Paradise wrote on 2013-08-02 20:05
Quote from merrykitten;1130757:
>Expected: 29.740741 +- 24.708784 steps
huh, i probably shouldn't have used integer division, it's probably the reason why 10000 tries usually yields 29 and not 30
also i suppose that the number should be highly variable
p.s.
yeah, i just tested, the result it usually higher than 29.6
its somewhat weird, because if we exclude the lvl down problem (which make the result be worst than a non lvl down case), the stones needed as average are much more higher than that, and the case is better than the real one.
1*0.5*0.5*0.45*0.45= rounded 5%
which means we need as average 5/0.05= 100 stones
(remember this is for NON LVL DOWN CASE! not the real thing)
also remember that being values near 50% means we have a high Dispersion on the values we might get, so people having success ingame with a few stones, or people using lots of stacks to get lvl 5 can be something normal
-
Zekkii wrote on 2013-08-02 20:17
Quote from Paradise;1130781:
its somewhat weird, because if we exclude the lvl down problem (which make the result be worst than a non lvl down case), the stones needed as average are much more higher than that, and the case is better than the real one.
1*0.5*0.5*0.45*0.45= rounded 5%
which means we need as average 5/0.05= 100 stones
(remember this is for NON LVL DOWN CASE! not the real thing)
including now the lvl down problem, it will make it higher, any number under 100 as average just indicates a problem on the code, compilator, or either luck factor.
Not to be rude, but that's the absolute worst case scenario. You are calculating it as though if it fails once in the five times from s/r0 to s/r5 then it will always consume 5 stones and always reset to 0.
-
Paradise wrote on 2013-08-02 20:20
Quote from Zekkii;1130787:
Not to be rude, but that's the absolute worst case scenario. You are calculating it as though if it fails once in the five times from s/r0 to s/r5 then it will always consume 5 stones and always reset to 0.
Its being calculated for average success
there is no scenario on this one, best case scenario is always being nearest the average, because you plan your resources in an efficient way.
and remember
Quote from Paradise;1130781:
(remember this is for NON LVL DOWN CASE! not the real thing)
the real thing is worst
-
RMorichika wrote on 2013-08-02 20:42
Quote from Paradise;1130781:
1*0.5*0.5*0.45*0.45= rounded 5%
which means we need as average 5/0.05= 100 stones
(remember this is for NON LVL DOWN CASE! not the real thing)
What on earth is that?
That looks like the % chance of getting successes 5 times in a row. That does not reflect the number of stones required to reach r5 at all. Even if you do fail a step, it only goes back one step, rather than forcing you to start over again.
-
Aliyah wrote on 2013-08-02 22:27
~30 on average to get r/s5 seems to mesh with my personal experience as well. Some people are way too lucky though :shoe:
-
merrykitten wrote on 2013-08-02 23:24
because the number is very variable. if you run a single step simulation it may be one time 50, next time 100, next time 5 , next time 10 etc
-
RMorichika wrote on 2013-08-03 00:50
Quote from merrykitten;1130830:
because the number is very variable. if you run a single step simulation it may be one time 50, next time 100, next time 5 , next time 10 etc
Yes, there will be variation, and yes, some outlying attempts might take a hundred stones or more, but the average is called an average rather than an absolute for a reason. If someone is here discussing this, I'm going to assume they're already aware that they're discussing the average, rather than a definite number of stones.
-
xi12570 wrote on 2013-08-03 04:14
We can visualize the variation a bit better if you aren't satisfied with the expected value.
Following on from my previous post #32:
[CODE]#Start with clean weapon in state 0
starting_state = np.zeros((6,1))
starting_state[0, 0] = 1
np.set_printoptions(precision=16, suppress=True, linewidth=1000)
for n in range(1, 200):
print np.dot(np.linalg.matrix_power(P.T, n), starting_state)[5][0][/CODE]
And then plot the output, with expected number +- standard dev. marked with vertical lines, and common NPC repair rates with horizontal lines:
[Image: http://i.imgur.com/abmP5ed.jpg]
It takes 119 stones to reach step 5 with 99% confidence. In other words, using more than 119 stones is about the same chance as Edern breaking any 1 independent point on your blessed item.
:cry:
-
merrykitten wrote on 2013-08-03 04:17
2 RMorichika
yeah, but don't forget that average it's one thing and dispersion, variance w/e it's called is another. this stuff has a quite high variance
-
Exkalamity wrote on 2013-08-03 05:27
Quote from xi12570;1130951:
We can visualize the variation a bit better if you aren't satisfied with the expected value.
Following on from my previous post #32:
[CODE]#Start with clean weapon in state 0
starting_state = np.zeros((6,1))
starting_state[0, 0] = 1
np.set_printoptions(precision=16, suppress=True, linewidth=1000)
for n in range(1, 200):
print np.dot(np.linalg.matrix_power(P.T, n), starting_state)[5][0][/CODE]
And then plot the output, with expected number +- standard dev. marked with vertical lines, and common NPC repair rates with horizontal lines:
[Image: http://i.imgur.com/abmP5ed.jpg]
It takes 119 stones to reach step 5 with 99% confidence. In other words, using more than 119 stones is about the same chance as Edern breaking any 1 independent point on your blessed item.
:cry:
And EXACTLY the kind of answer I was looking for when I asked the question. Sexy graph is sexy (but the results aren't).
-
Rydian wrote on 2013-08-03 16:59
Maybe I should have titled this "Probability Is Pain"?