Sha256: 5b68038c25ae067367e300047d5eeea985045b8cd9cb334cb88986de964a9f42

Contents?: true

Size: 507 Bytes

Versions: 37

Compression:

Stored size: 507 Bytes

Contents

final Map<String, int> _scores = const {
  'a': 1,
  'e': 1,
  'i': 1,
  'o': 1,
  'u': 1,
  'n': 1,
  'l': 1,
  'r': 1,
  's': 1,
  't': 1,
  'd': 2,
  'g': 2,
  'b': 3,
  'c': 3,
  'm': 3,
  'p': 3,
  'f': 4,
  'h': 4,
  'v': 4,
  'w': 4,
  'y': 4,
  'k': 5,
  'j': 8,
  'x': 8,
  'z': 10,
  'q': 10
};

int score(String word) {
  int val = 0;
  if (word.length > 0) {
    word.split('').forEach((char) {
      int score = _scores[char.toLowerCase()];
      val += score ?? 0;
    });
  }
  return val;
}

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.179 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.178 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.177 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.176 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.175 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.174 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.173 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.172 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.171 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.170 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.169 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.167 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.166 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.165 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.164 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.163 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.162 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.161 tracks/dart/exercises/scrabble-score/lib/example.dart
trackler-2.2.1.160 tracks/dart/exercises/scrabble-score/lib/example.dart