digital_electricity: Result checking: check result in dataset

Authored by rudranilbasu on Aug 22 2017, 6:56 PM.

Description

digital_electricity: Result checking: check result in dataset

Previously, we were checking the result for each level in the js, via
brute force checking of the level numbers to decide the answer of an
operation:

if (currentLevel == ...) {
      ...
} else if (currentLevel == ...) {
      ...
}
...

This is avoided by keeping a result() function in the dataset itself,
and the operationResult is calculated via:

operationResult = levelProperties[currentLevel - 1].result(A, B)

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

Details

Committed
rudranilbasuAug 22 2017, 7:06 PM
Parents
R2:3d8657914e41: digital_electricity: Move in the playArea
Branches
Unknown
Tags
Unknown