Created
April 6, 2014 22:56
-
-
Save samjarman/10012291 to your computer and use it in GitHub Desktop.
A simple simulation to determine the best way to allocate tablets, failure cards, success cards and delay cards in Tablets of Stone
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
import random | |
tablets = 5 | |
chance_dnd = 0.30 | |
chance_delayed = 0.30 | |
chance_arrived = 1.0 - chance_dnd - chance_delayed | |
runs = 1000 | |
total_failed = 0 | |
total_delayed = 0 | |
total_crossed = 0; | |
for i in range(runs): | |
#work out the chance that all tablets cross | |
cross = 0; | |
delayed = 0; | |
fail = 0; | |
for i in range(tablets): | |
r = random.random() | |
if r >= 0 and r < chance_arrived: | |
cross += 1 | |
elif r >= chance_arrived and r < (chance_arrived + chance_delayed): | |
delayed += 1 | |
else: | |
fail += 1 | |
#print([cross, delayed, fail]) | |
total_crossed += cross | |
total_failed += fail | |
total_delayed += delayed | |
print("Successful, delayed, failed") | |
print([total_crossed/runs, total_delayed/runs, total_failed/runs]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment