Created
November 1, 2018 20:15
-
-
Save lironsade/ae3b298f41792349e8987f1d10a2d749 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
from itertools import product | |
best = 0 | |
ta = 0 | |
tb = 0 | |
for a,b in product(range(0,11), range(0,11)): | |
if (a == 0 and b == 0) or (a == 10 and b == 10): | |
rate = 0.5 | |
else: | |
rate = 0.5 * (a/(a+b) + (10-a)/(20-a-b)) | |
if rate > best: | |
ta, tb = a, b | |
best = rate | |
print("a: {}, b: {}, rate: {}".format(a,b,rate)) | |
print("best is: {}, with a,b = {}, {}".format(best, ta, tb)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment