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.33 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.32 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.31 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.30 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.29 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.28 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.27 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.26 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.25 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.24 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.23 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.22 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.21 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.20 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.19 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.18 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.17 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.16 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.15 tracks/perl6/exercises/scrabble-score/example.yaml
trackler-2.2.1.14 tracks/perl6/exercises/scrabble-score/example.yaml