calculateScore method

  1. @override
int calculateScore(
  1. dynamic result
)
override

The result of this activity is a list of mistakes for each test repetition. The list is empty if no mistakes were made. For every repetition with 0 mistakes a score of 1 is added. The final score is the sum of repetitions with 0 mistakes.

Implementation

@override
int calculateScore(dynamic result) {
  var sum = -1;
  try {
    List<int> mistakes = result['mistakes'] as List<int>;
    for (var round in mistakes) {
      if (round < amountOfTargets) {
        sum += 1;
      }
    }
  } catch (error) {
    print('$runtimeType - Error calculating score: $error');
  }
  return sum;
}