]> git.donarmstrong.com Git - bin.git/blob - scrabble_score
add reset usb bus command
[bin.git] / scrabble_score
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 my %tile_values = ('a' => 1, 'b' => 3, 'c' => 3, 'd' => 2,
7                    'e' => 1, 'f' => 4, 'g' => 2, 'h' => 4,
8                    'i' => 1, 'j' => 8, 'k' => 5, 'l' => 1,
9                    'm' => 3, 'n' => 1, 'o' => 1, 'p' => 3,
10                    'q' => 10, 'r' => 1, 's' => 1, 't' => 1,
11                    'u' => 1, 'v' => 4, 'w' => 4, 'x' => 8,
12                    'y' => 4, 'z' => 10, "\*" => 0);
13
14 use List::Util qw(sum);
15
16 while (<>) {
17     chomp;
18     my $score = sum(map {$tile_values{lc($_)}} split //);
19     print $score . ' '.$_."\n";
20 }