Created
July 15, 2022 23:13
-
-
Save jamie/9a88b0069c2e180ec0d189aa9db37df5 to your computer and use it in GitHub Desktop.
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
players / spoken to | |
1 2 3 4 5 6 7 | |
7 66% 40% 80% 60% 100% | |
8 71% 48% 86% 71% 100% | |
9 75% 53% 89% 79% 100% | |
10 67% 42% 77% 60% 88% 76% 100% | |
11 70% 47% 82% 67% 92% 83% 100% | |
12 73% 51% 85% 72% 94% 88% 100% | |
13 66% 42% 76% 59% 85% 73% 93% | |
14 69% 46% 80% 65% 88% 78% 95% | |
15 71% 49% 82% 69% 91% 83% 97% | |
# NB: No results for speaking to 8 people at 13+ players, it's a _very_ slow calculation. 9 players is 100% though. |
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
# Run me on https://replit.com/languages/ruby | |
require 'pp' | |
results = [] | |
1.upto(7) do |speak_to| | |
7.upto(15) do |player_count| | |
evils = case player_count | |
when (5..9); 2 | |
when (10..12); 3 | |
when (13..15); 4 | |
end | |
more_evil = 0 | |
more_good = 0 | |
1.upto(player_count-1).to_a.permutation(speak_to) do |values| | |
speak_to_good, speak_to_evil = values.partition{|value| value > evils } | |
if speak_to_good.size > speak_to_evil.size | |
more_good += 1 | |
else | |
more_evil += 1 | |
end | |
end | |
results << [player_count, speak_to, more_good.to_f / (more_good + more_evil)] | |
pp results.last | |
end | |
end | |
pp results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment