ilmtest / ilmtest-bb10

Ilm Test trivia game
0 stars 0 forks source link

Improve numeric question multiple choice number generation algorithm #84

Closed ragaeeb closed 8 years ago

ragaeeb commented 8 years ago

Currently always the 3rd choice is the answer...

ragaeeb commented 8 years ago

A question which has a numeric answer where the user is presented with a multiple choice question where they are expected to pick the correct number. The incorrect choices must not be static and may change depending on the answer value.

This solution here would allow presenting different values for the exact same question, so that if the user plays the game more than once and hits the same question the question will not be presented the same way. An example of such a question is « How old was the Prophet (sallahu alayhi wa’sallam) when revelation came to him ? »

Case #1: If the numeric answer value < n (where n is the maximum # of multiple choices to offer) — In this situation it will not make sense to generate negative numeric choices (ie : -1, -2). It also might not sometimes make sense to generate 0 as a possible value. For example if n = 3, you don’t want to generate -1. — Algorithm : In this case, always show the sequence of up to n. For example, if n = 4, then anytime this question is hit, you will always show 1,2,3,4. If the answer happens to be 1, or 2, or 3 or 4, and n = 4 the user will never be able to figure out the algorithm because no matter what the answer is the same sequence is presented.

Case #2: If the numeric answer value >= n (where n is the maximum # of multiple choices to offer) — In this situation we want to generate a bunch of wrong answers that are very close to the actual value. For example a question might be, « At what year did Shaykh Albaani (rahimullah) pass away ? » and if the answer is 2001, you don’t want to generate values like 1973, or 2015 which may be obviously false to the user at first glance. Also, the algorithm must not be detectable by the user. — The algorithm chosen must not be detectable by the user. For example if the algorithm was to always generate 3 wrong values that are > than the answer, then we would generate 2002, 2003, 2004. For another similar question where the answer was the number 15, we would generate 16, 17, 18. And eventually the more the user received questions like this, they would know that the first value in the sequence would be the right answer. In the same wayif we always generated values less than the answer, the user would figure out the largest value is always the right answer. If we generated answer+1, answer-1, answer-2 as wrong answers, the user would always know that a specific index would always be the right answer. As a result, the algorithm must be a combination of all of these. — Algorithm : var correctAnswer = 5; random = generateRandom(0,3) ; // generate random # bewteen 0 and 3 inclusive

if (random == 0) // generate choices all less than correctAnswer, therefore [2,3,4,5] else if (random == 1) // generate all greater than correct answer, therefore [5,6,7,8] else if (random == 2) // generate [answer+1,answer-1,answer+2], therefore [4,5,6,7] else // generate [answer+1,answer-1,answer-2], therefore [3,4,5,6]

Case #3: If the number of answers > 1 — An example of this case a question like, « In which of the following years did the Prophet (sallahu alayhi wa’sallam) make Hijrah ? ». And let’s say the answers are 1156, 1161, and 1162. We need to be able to generate a bunch of incorrect answers that do not overlap with the actual right answers. In a situation where we want to present all three answers in the question, then we will need an upper limit on the number of wrong choices we will display. For example, we can let them choose 3/4 answers in a list where they can select more than one item. But it might be even more challenging for the user to pick 3 out of a list of 10 incorrect answers. — TODO

ragaeeb commented 8 years ago

db6a65ea7dac7f1ceec5bcb59453d671d0d1bb2f