You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in or create an account, your edits will be attributed to your username, along with
other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision |
Your text |
Line 86: |
Line 86: |
| print(total/count) | | print(total/count) |
|
| |
|
| : --[[User:Rezuaq|Rezuaq]] ([[User talk:Rezuaq|talk]]) 05:15, December 23, 2021 (EST)
| | --[[User:Rezuaq|Rezuaq]] ([[User talk:Rezuaq|talk]]) 05:15, December 23, 2021 (EST) |
| | |
| :: Update: I realised you don't even need to simulate anything, it's actually faster to just compute every possible winning game and use that to get the exact expected values. I have amended the table.
| |
| :: Python 3 code:
| |
| import itertools
| |
| import math
| |
|
| |
| one = 1; five = 5; xfive = 25
| |
| winningBlocks = [one, one, one, one, five, five, five, xfive, xfive]
| |
|
| |
| def evaluate(blocks):
| |
| total = 0
| |
| for block in blocks:
| |
| if block == one or block == five:
| |
| total += block
| |
| elif block == xfive:
| |
| total *= 5
| |
| return total
| |
|
| |
| print()
| |
| for mode in [5, 7, 9]:
| |
| print('====== %d-Block Option =====' % mode)
| |
| count = math.factorial(11)//math.factorial(11-mode)
| |
| print('# of combos:', count)
| |
| winCount = math.factorial(9)//math.factorial(9-mode)
| |
| print('# of non-losing combos:', winCount)
| |
|
| |
| # Only evaluate the winning combos-- far less than the actual total number of combinations.
| |
| total = sum(evaluate(perm) for perm in itertools.permutations(winningBlocks, mode))
| |
|
| |
| print()
| |
| print('E[x | winning] =', total/winCount)
| |
| print('E[x] =', total/count)
| |
| if mode == 9: print('(9-block bonus multiplier: Multiply by 2 to get the in-game reward)')
| |
| print()
| |
| :: --[[User:Rezuaq|Rezuaq]] ([[User talk:Rezuaq|talk]]) 06:03, December 24, 2021 (EST)
| |