sightLevelScores function

List<double> sightLevelScores([
  1. int? lastLevel
])

A média do sightDifficulty do d de cada nível, do 1 ao último (o índice 0 é o nível 1). Gera kMusicEstimateSeeds exercícios por nível: custa alguns segundos, então a tela chama em segundo plano (compute).

Implementation

List<double> sightLevelScores([int? lastLevel]) {
  final last = lastLevel ?? sightLastLevel;
  return [
    for (var level = 1; level <= last; level++)
      () {
        final step = sightStep(level, sightSubLevels - 1);
        var sum = 0.0;
        for (var seed = 0; seed < kMusicEstimateSeeds; seed++) {
          sum += sightDifficulty(
            generateSight(step, Random(level * 1000 + seed)),
          ).score;
        }
        return sum / kMusicEstimateSeeds;
      }(),
  ];
}