Created
November 23, 2020 03:51
-
-
Save mattmazzola/c2af7ba5307a2e9ab879ef927f116f5d to your computer and use it in GitHub Desktop.
Get question within range
This file contains hidden or 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
const minRating = player.rating - ratingRange | |
const maxRating = player.rating + ratingRange | |
const isRatingWithinRange = (question: Question) => minRating <= question.rating && question.rating <= maxRating | |
const question = getRandomWhichMeetsConstraints(questions, isRatingWithinRange) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment