# Talk:Jump Attack

From the Super Mario Wiki, the Mario encyclopedia

## Mathematical expectation[edit]

I'm the one who wrote the "Mathematical expectation" section. I'm not really good at math so I want you to check the program I used to calculate the data. It's written in Python 2:

one=1 five=2 x5=3 bowser=4

import itertools

l=[one,one,one,one,five,five,five,x5,x5,bowser,bowser] p=itertools.permutations(l,5) # change to 7, 9

def coins(l): l=list(l) s=0 while len(l): a=l[0] del l[0] if a==one: s+=1 elif a==five: s+=5 elif a==x5: s*=5 elif a==bowser: s=0 break else: raise NameError('wtf?') return s

ans=[coins(l) for l in p] s=sum(ans)

print s/len(ans) print s print len(ans)

The result is:

11 661200 55440

11 18385920 1663200

3 71245440 19958400

Since the 9-Block Option has a bonus, the real number of coins earned is 6.

I daren't calculate the variance because my machine is slow. Another gossip-loving Toad (talk) 22:32, 20 October 2014 (EDT)