Skip to content

Instantly share code, notes, and snippets.

@oliverbenns
Created June 14, 2017 12:53
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 oliverbenns/b415f972266af466f17d3ef17a889954 to your computer and use it in GitHub Desktop.
Save oliverbenns/b415f972266af466f17d3ef17a889954 to your computer and use it in GitHub Desktop.
Level averaging
const attempts = [
[ 1.613, 4.2010000000000005, 13.652000000000001, 7.035, 5.371, 9.951, 8.934000000000001, 5.534, 4.251, 7.636, 15.402000000000001, 6.384 ],
[ 1.401, 5.051, 11.852, 5.534, 3.384, 4.95, 6.501, 7.1850000000000005, 5.702, 5.401, 10.685, 5.867 ],
[ 1.349, 3.984, 9.401, 2.983, 4.0840000000000005, 5.05, 6.939, 5.7170000000000005, 3.517, 3.384, 9.185, 6.417 ],
];
const levels = [];
for (let i = 0; i < attempts[0].length; i++) {
const levelResults = attempts.map(attempt => {
return attempt[i];
});
const average = Math.round(levelResults.reduce((x, y) => x + y) / levelResults.length);
levels.push(average);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment