Cody

Problem 3048. Scrabble Scores - 3

Solution 3025561

Submitted on 2 Oct 2020 by Augusto Mazzei
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
word = 'matlab'; mult = {'','DW','','','','DL'}; score = 26; assert(isequal(scrabble_scores_3(word,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 26

2   Pass
word = 'problem'; mult = {'','','','','','',''}; score = 13; assert(isequal(scrabble_scores_3(word,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 13

3   Pass
word = 'zither'; mult = {'','DW','','','','DW'}; score = 72; assert(isequal(scrabble_scores_3(word,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 72

4   Pass
word = 'quandry'; mult = {'TL','','','','TL','',''}; score = 44; assert(isequal(scrabble_scores_3(word,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 44

5   Pass
word = 'concatenates'; mult = {'TW','','','DL','','','','TW','','','','DL'}; score = 180; assert(isequal(scrabble_scores_3(word,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 180

6   Pass
word = 'heterogeneousness'; mult = {'QW','','','DL','','','','TW','','','DL','','','TW','','',''}; score = 828; assert(isequal(scrabble_scores_3(word,mult),score))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 828

7   Pass
word = {'hello','donut','cheat','shape','quote'}; mult = {'QW','','','DL',''}; score = [36 28 44 52 60]; ind = randi(5); assert(isequal(scrabble_scores_3(word{ind},mult),score(ind)))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 60

8   Pass
word = {'hello','donut','cheat','shape','quote'}; mult = {'QL','','','','DW'}; score = [40 24 38 26 88]; ind = randi(5); assert(isequal(scrabble_scores_3(word{ind},mult),score(ind)))

p = 1 3 3 2 1 4 2 4 1 8 5 1 3 1 1 3 10 1 1 1 1 4 4 8 4 10 score = 26

Suggested Problems

More from this Author139

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!