Sha256: 0079e23d670ebf2e19bac2fcbf70e682bd9742edf9d8689d0399ba1fa4ed4ab0

Contents?: true

Size: 747 Bytes

Versions: 82

Compression:

Stored size: 747 Bytes

Contents

exercise: Scrabble
version: 1
plan: 13
imports: '&score'
tests: |
  is .<input>.&score, |.<expected description> for @($c-data<cases>);

unit: module
example: |
  sub score (Str:D $word --> Int:D) is export {
    my $score = 0;
    for $word.lc.split('',:skip-empty) -> $letter {
      given $letter {
        when * ~~ /<[aeioulnrst]>/ { $score += 1  }
        when * ~~ /<[dg]>/         { $score += 2  }
        when * ~~ /<[bcmp]>/       { $score += 3  }
        when * ~~ /<[fhvwy]>/      { $score += 4  }
        when * ~~ /k/              { $score += 5  }
        when * ~~ /<[jx]>/         { $score += 8  }
        when * ~~ /<[qz]>/         { $score += 10 }
      }
    }
    return $score;
  }
stub: |
  sub score ($word) is export {
  }

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
trackler-2.2.1.53 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.52 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.51 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.50 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.49 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.48 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.47 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.46 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.45 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.44 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.43 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.42 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.41 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.40 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.39 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.38 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.37 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.36 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.35 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.34 tracks/perl6/exercises/scrabble-score/example.yaml