Last active
June 2, 2020 15:53
-
-
Save arisada/64104411bf762597de9441d2039bfdb7 to your computer and use it in GitHub Desktop.
Revisions
-
arisada revised this gist
Jun 2, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import random change_strategy, stay_strategy = 0, 0 for i in range(1000): v = [True, False, False] random.shuffle(v) print("Solution:", v) -
arisada created this gist
Jun 2, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/usr/bin/env python3 import random change_strategy, stay_strategy = 0, 0 for i in range(1): v = [True, False, False] random.shuffle(v) print("Solution:", v) firstchoice = random.choice([0, 1, 2]) print("First choice", firstchoice) others = [i for i in [0, 1, 2] if i != firstchoice] if v[firstchoice]: closed = random.choice(others) else: closed = others[1] if v[others[0]] else others[0] print("closing", closed) if v[firstchoice]: print("Stay wins") stay_strategy += 1 remaining_choices = [i for i in [0, 1, 2] if i != firstchoice and i != closed] if v[remaining_choices[0]]: print("Change wins") change_strategy +=1 print(change_strategy, stay_strategy)