Talk:Jump Attack

Mathematical expectation
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)


 * Hi, I was curious about the expected reward as well, and when I saw the wiki page didn't list them, I ended up writing uncannily similar code as yours (I only checked the "talk" page after writing it), and found the same approximate values.
 * I also saw that you'd added this to the page at first, but later removed them again since you didn't trust your numbers...I suppose my independently written code arriving at the same numbers would fully corroborate it, assuming the game does not secretly alter the game rules in the player's favor or something.
 * With that caveat, I'm adding it back into the article.
 * (Here's my code, python 3)

import numpy as np bowser = 0 one = 1 five = 5 xfive = 25 blocks = [one, one, one, one, five, five, five, xfive, xfive, bowser, bowser] def evaluate(blocks): total = 0 for block in blocks: if block == one or block == five: total += block elif block == xfive: total *= 5 else: return 0 return total count = 100_000 # Number of simulated games to run, increase for more accurate average mode = 5 # Chance to 7 or 9 total = sum( evaluate(np.random.permutation(blocks)[:mode]) for _ in range(count) ) print(total/count)


 * --Rezuaq (talk) 05:15, December 23, 2021 (EST)