Skip to content

Instantly share code, notes, and snippets.

@jaredj
Last active September 21, 2022 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredj/61c7ecb4aa964155f6e89c4570acc97b to your computer and use it in GitHub Desktop.
Save jaredj/61c7ecb4aa964155f6e89c4570acc97b to your computer and use it in GitHub Desktop.
function sum(arr) {
return arr.reduce((sum, x) => sum + x);
}
function pollguesses(r) {
var trolls = r.slice(0,3);
var min_trolls = Math.max(...trolls);
var max_trolls = sum(trolls);
var max_participants = r[7];
var min_participants = max_participants - min_trolls;
var min_censors = Math.min(r[3],r[5]);
var min_censors_pct = Math.round(min_censors / max_participants * 100);
var max_censors = Math.max(r[3],r[5]);
var max_censors_pct = Math.round(max_censors / min_participants * 100);
var max_lawyers = r[4];
var min_lawyers = max_lawyers - min_trolls;
var min_lawyers_pct = Math.round(min_lawyers / max_participants * 100);
var max_lawyers_pct = Math.round(max_lawyers / min_participants * 100);
var min_ruminators_pct = 100 - max_lawyers_pct;
var max_ruminators_pct = 100 - min_lawyers_pct;
console.log(`probably ${min_trolls} but as many as ${max_trolls} respondents were confused or just want to watch the world burn`);
console.log(`${min_participants}-${max_participants} respondents were probably serious`);
console.log(`${min_censors_pct}%-${max_censors_pct}% of respondents want discussion/debate only for people directly involved (niceties for everyone else)`);
console.log(`${min_lawyers_pct}%-${max_lawyers_pct}% of respondents want to put a stop to speculation`);
console.log(`${min_ruminators_pct}%-${max_ruminators_pct}% of respondents consider speculation to be an appropriate exercise`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment