Created
April 23, 2017 03:59
-
-
Save strycore/de660dbc9d4c583ca445b548ddd94ad8 to your computer and use it in GitHub Desktop.
The least efficient algorithm on earth
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 itertools | |
from decimal import Decimal | |
from collections import Counter | |
NUM_REVIEWERS = 3 | |
NUM_SEGMENTS = 4 | |
# Compute all possible scores for one segment | |
segment_scores_outcomes = [] | |
for c in itertools.product(range(1, 5), repeat=NUM_REVIEWERS): | |
segment_scores_outcomes.append(c) | |
scores = [] | |
for c in itertools.product(segment_scores_outcomes, repeat=NUM_SEGMENTS): | |
segment_scores = [] | |
for segment in c: | |
segment_scores.append(sum(segment) // NUM_REVIEWERS) | |
scores.append(sum(segment_scores) // NUM_SEGMENTS) | |
counts = Counter(scores) | |
total = len(scores) | |
print("Total possibilities: ", total) | |
for c in counts: | |
print("{} chair{}: {}%".format(c, | |
's' if c > 1 else '', | |
Decimal((counts[c] / total) * 100))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment