Last active
October 1, 2016 08:38
-
-
Save amaotone/d4f785c9d356a6bc5d5dab89b2eb9cfa to your computer and use it in GitHub Desktop.
絶対に龍巫女引く
This file contains hidden or 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 numpy as np | |
| INIT_HAND = 3 | |
| INIT_DECK = 40 | |
| def probability(deck): | |
| return np.array([(deck-i)/deck for i in range(1, INIT_HAND+1)]) | |
| def main(): | |
| p = np.array([1., 1., 1.]) | |
| # mulligan | |
| for i in range(INIT_HAND): | |
| p *= probability(INIT_DECK-i) | |
| # game start | |
| for i in range(INIT_DECK): | |
| p *= probability(INIT_DECK-i) | |
| turn = max(0, i+1-INIT_HAND) | |
| if turn: | |
| print("{0:>2}T {1[0]:.3f} {1[1]:.3f} {1[2]:.3f}".format(turn, 1-p)) | |
| if __name__ == '__main__': | |
| main() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
実行結果