Skip to content

Instantly share code, notes, and snippets.

@theo-bittencourt
Created February 2, 2015 21:24
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 theo-bittencourt/56fb4dc7d0a12f433907 to your computer and use it in GitHub Desktop.
Save theo-bittencourt/56fb4dc7d0a12f433907 to your computer and use it in GitHub Desktop.
Quiz Score
value =
if answer.seconds <= 3
Question::BASE_SCORE_VALUE
else
# Value is proportional to time taken to answer the question.
Question::BASE_SCORE_VALUE * (1 - (answer.seconds.to_f / Question::MAX_TIME_TO_ANSWER))
end
# Double value if question is bonus
value * (answer.question.bonus? ? 2 : 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment