I am doing some research at the moment into creating a new maths game for primary school children where divs from 0-9 appear at random inside a container.
A question is given at the beginning. Something like, multiples of 20. The user will then have to click on the correct ones, and they will then be counted at the end and a score will be given.
So at the moment I have the basic structure, divs pop up and you click them and it adds to the correct answer, meaning there is no wrong answer at this point in time.
I want to know what the best way of determining the right and wrong answers is. Is there and algorithm that I can use that will work out whether the answers are right or wrong, and how would I link it to the divs?
<div id="container">
<div id="char1" class="character right1" vaule="1"></div>
<div id="char2" class="character right2" vaule="2"></div>
<div id="char3" class="character right3" vaule="3"></div>
<div id="char4" class="character right4" vaule="4"></div>
<div id="char5" class="character right5" vaule="5"></div>
<div id="char6" class="character right6" vaule="6"></div>
<div id="char7" class="character right7" vaule="7"></div>
<div id="char8" class="character right8" vaule="8"></div>
<div id="char9" class="character right9" vaule="9"></div>
<div id="char9" class="character right0" vaule="0"></div>
</div>
wrong answers will be given the class “.wrong” as apposed to “.right”
Fiddle: http://jsfiddle.net/SKB3Q/10/
The first thing you need to do is come up with a question for any notion of right or wrong to make sense.
For example: “Click all numbers that are greater than 20”
The second thing you need to do is express this question as a boolean expression that evaluates to true or false.
Then evaluate this expression for each selection to determine whether it is right or wrong.
Here is an example of what I mean. Before the game starts, the script adds the appropriate class to each element. The question is “Select all numbers greater than 5”