Last active
July 1, 2021 01:55
-
-
Save DMBuce/c45f6d7acb91f6fa59fc1fa8be2ef396 to your computer and use it in GitHub Desktop.
Script to calculate expected number of items bartered from a stack of gold blocks in Minecraft 1.17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
items=[ | |
{"name": "soul speed book", "num":1, "chance":5/459, "stacksize":1}, | |
{"name": "soul speed boots", "num":1, "chance":8/459, "stacksize":1}, | |
{"name": "splash fire resist potion", "num":1, "chance":8/459, "stacksize":1}, | |
{"name": "fire resist potion", "num":1, "chance":8/459, "stacksize":1}, | |
{"name": "water bottle", "num":1, "chance":10/459, "stacksize":1}, | |
{"name": "iron nugget", "num":sum([10,36])/2, "chance":10/459, "stacksize":64}, | |
{"name": "ender pearl", "num":sum([2,4])/2, "chance":10/459, "stacksize":16}, | |
{"name": "string", "num":sum([3,9])/2, "chance":20/459, "stacksize":64}, | |
{"name": "quartz", "num":sum([5,12])/2, "chance":20/459, "stacksize":64}, | |
{"name": "obsidian", "num":1, "chance":40/459, "stacksize":64}, | |
{"name": "crying obsidian", "num":sum([1,3])/2, "chance":40/459, "stacksize":64}, | |
{"name": "fire charge", "num":1, "chance":40/459, "stacksize":64}, | |
{"name": "leather", "num":sum([2,4])/2, "chance":40/459, "stacksize":64}, | |
{"name": "soul sand", "num":sum([2,8])/2, "chance":40/459, "stacksize":64}, | |
{"name": "nether brick", "num":sum([2,8])/2, "chance":40/459, "stacksize":64}, | |
{"name": "spectral arrow", "num":sum([6,12])/2, "chance":40/459, "stacksize":64}, | |
{"name": "gravel", "num":sum([8,16])/2, "chance":40/459, "stacksize":64}, | |
{"name": "blackstone", "num":sum([8,16])/2, "chance":40/459, "stacksize":64}, | |
] | |
gold = 64 * 9 | |
print(" STACKS | ITEMS | NAME") | |
for item in items: | |
print(" {:-6.2f} | {:-6.2f} | {}".format( | |
gold * item['chance'] * item['num'] / item['stacksize'], | |
gold * item['chance'] * item['num'], | |
item['name'] | |
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STACKS | ITEMS | NAME | |
0.78 | 50.20 | fire charge | |
0.78 | 50.20 | obsidian | |
1.57 | 100.39 | crying obsidian | |
2.35 | 150.59 | leather | |
2.35 | 150.59 | string | |
2.35 | 37.65 | ender pearl | |
3.33 | 213.33 | quartz | |
3.92 | 250.98 | nether brick | |
3.92 | 250.98 | soul sand | |
4.51 | 288.63 | iron nugget | |
6.27 | 6.27 | soul speed book | |
7.06 | 451.76 | spectral arrow | |
9.41 | 602.35 | blackstone | |
9.41 | 602.35 | gravel | |
10.04 | 10.04 | fire resist potion | |
10.04 | 10.04 | soul speed boots | |
10.04 | 10.04 | splash fire resist potion | |
12.55 | 12.55 | water bottle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment