Problem 3047. Scrabble Scores - 2
An introductory Cody problem asks the user to score a Scrabble word. This problem is part of a set of problems that successively develop a more sophisticated Scrabble scoring routine.
Scrabble is a word board game wherein each letter tile is scored roughly according to its frequency (or lack thereof) in words. More common letters, such as vowels, are worth fewer points while difficult letters, such as Q, Z, J, and X are worth more points. The point distribution is provided here. (Use the English points distribution.)
For this problem, you will be provided with a cell array of words (e.g., all the words from one player in a game). Write a function to calculate the total score for the set of words.
Related problems:
Previous problem: 1 - Single-word scoring. Next problem: 3 - Single-word multiplier scoring.
Solution Stats
Problem Comments
-
7 Comments
Suggestion: use a pangram for a test to make sure all letters are scored correctly. There are plenty in there: http://rinkworks.com/words /pangrams.shtml including the famous 'the quick brown fox jumps over a lazy dog'.
Thanks. I added two cases with that pangram repeated, one in one cell string and the other broken into a cell array, as in the other test cases. It's possible, however unlikely, to score the pangram test case right with the wrong letter scores applied, since we're just testing the cumulative score. Having the second case as an array of words that must add to the same score makes the likelihood of wrong letter points sets passing the test extremely unlikely. By any means, figuring out all the possible mis-applied letter point sets that produce the same final score sounds like another Cody problem, along the lines of James's problems.
Thanks....I think? :-)
Of course. Your problems are often quite original (especially when your daughter hacks into your account). I just wish that you wouldn't use such large numbers in some (practically all) of your problems. There are a few that I've been able to solve, except for the large-number case or two that prevents the solution from passing all cases. Do you have any suggestions for resources on large-number calculations?
I'm glad you enjoy my problems. If there are large numbers in the test suite, it means there's a simple formula you can use to solve it, rather than a brute force approach. (My daughter just hacked into my account again to ask for help...go ahead and try my newest problem!)
Thanks for this "revival" of the good old scrabble problem! This opened my exes and show me how much I learned since I play here on cody. My first answer of the original (first) scrabble has score for quite 200 Points!! yesterday I rewrote my solution in only one code line. ;-)
Thanks for the feedback. I've learned a lot playing on Cody, too. It's quite an engaging work/play online system.
Solution Comments
Show commentsProblem Recent Solvers58
Suggested Problems
-
given 3 sides, find area of this triangle
794 Solvers
-
Program an exclusive OR operation with logical operators
711 Solvers
-
Create a vector whose elements depend on the previous element
649 Solvers
-
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
1744 Solvers
-
5046 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!