digital_electricity: Fix OK button skipping levels

Authored by rudranilbasu on Aug 18 2017, 8:27 PM.

Description

digital_electricity: Fix OK button skipping levels

The OK button was checking for the answer and if correct, the level was
changed after showing a "happy tux" image. However, once we press the OK
button for the same correct answer twice, the answer was calculated
twice and because of the delay between deciding the answer and changing
the level, the "happy tux" was shown twice and as a result a level was
skipped. This is avoided by keeping a variable "processingAnswer" to
check whether the answer is being checked or not. If yes, we do not
evaluate the OK click

if (processingAnswer)
    return

If the calculated result is a wrong answer, the value of
processingAnswer is reset to its default value (false). If it is true,
we transition to the next level, and the value of processingAnswer is
marked false in the "initLevel()" method.

Fixed level 20 being incorrectly put in the "others" problem type, which
should be under the "problemType.equation2Variables" group, since it
deals with comparing two variables represented as switches.

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>

Details

Committed
rudranilbasuAug 18 2017, 8:27 PM
Parents
R2:08d66bb46566: digital_electricity: generalised answer checking
Branches
Unknown
Tags
Unknown