Home › Forums › Show Feedback › Math with chairs or the most inefficient algorithm on earth
 This topic has 3 replies, 2 voices, and was last updated 7 years ago by strider.

AuthorPosts

October 2, 2016 at 5:37 pm #67812striderParticipant
This is something I wanted to know for… well since I’ve watched LGCW for the first time.
I calculated the distribution of chairs used for the reviews to output of probabilities of any given score. Like I expected, the rating system will heavily skew in favor of 2 chairs ratings so it’s not a big surprise most of the games reviewed get 2 chairs.
And since I now nothing about math, I ran a simulation of every possible outcome which is possibly the worst way ever to do this with a complexity of O(YOU SUCK).Anyway here are the results:
Quote:Total possibilities: 16777216
1 chair: 19.472599029541015625%
2 chairs: 78.59363555908203125%
3 chairs: 1.9337594509124755859375%
4 chairs: 0.0000059604644775390625%Wow, almost 80% for 2 chairs! And less than 2% for 3! I wasn’t expecting that. Of course there will be more than 2% of reviewed games with a total of 3 chairs because in reality the chairs aren’t evenly distributed, there’s a higher probability for a good game to get 3 chairs. Of course, the 4 chair score was expected and can only happen with the power of magical ponies.
And here is the code (Python3, NOT Python 2):
Code:import itertools
from decimal import Decimal
from collections import CounterNUM_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)))If anyone wants to teach me a thing or two about how to math, I’d appreciate it
October 2, 2016 at 5:44 pm #76785striderParticipantFor the record, those are the results if proper rounding was applied:
Quote:Total possibilities: 16777216
1 chair: 0.04425048828125%
2 chairs: 63.94195556640625%
3 chairs: 35.47821044921875%
4 chairs: 0.53558349609375%with the code:
Code:segment_scores.append(round(sum(segment) / NUM_REVIEWERS))
scores.append(round(sum(segment_scores) / NUM_SEGMENTS))October 2, 2016 at 5:44 pm #76786linuxgnuruParticipantQuote:unless it’s in an Excel spreadsheet with charts, i see nothing.quote from my old boss at WalMart.
also, i wonder how much simplified it could be if done in C or assembly…
October 2, 2016 at 5:52 pm #76787striderParticipantlinuxgnuru wrote:Quote:unless it’s in an Excel spreadsheet with charts, i see nothing.quote from my old boss at WalMart.
also, i wonder how much simplified it could be if done in C or assembly…
How do you give a visual representation of 79% vs 0.000005%?
It wouldn’t be simplified, Python already provides handy functions such as product, sum and Counter. It’s not the choice of language that is bad, it’s the algorithm. I’m pretty sure there are some basic math concept that I don’t know about (or knew about but have long forgotten) that would make this code way more performant. C or Assembly don’t magically fix bad code.

AuthorPosts
 You must be logged in to reply to this topic.