科迪
对于这个问题,你的任务是为一个完成的多人Scrabble板打分。您将得到一个字符矩阵,表示一个完整的Scrabble游戏,玩家数量(2到4),一个表示单词放置顺序的顺序数组,以及一个对应于字符板的乘数板。
关于order数组的详细信息请参见上一个问题(下面的链接)。那个问题的所有其他细节都应该保留下来。倍增器板将是一个与倍增器板大小相同的字符矩阵,其中字母(小写)或单词(大写)倍增器包含以下单字母条目:
* D:双字母* T:三字母* Q:四字母* D:双字母* T:三字母* Q:举个例子,假设你有下面的板子(这是测试用例1): cat ip t poet cl there 乘数矩阵看起来是这样的: t d t d d d t d t 第一个要玩的单词,itch,没有覆盖任何乘数平方,所以评分和通常一样。这里的第二个单词,除了底部中间的双字母(d)方块外,还包括了左下角的三个字母(T)方块。这意味着最后一个e翻了一倍(2分而不是1分),整个单词的分数是三倍。下一个要播放的单词apple覆盖了中间的双字母(D)正方形和上面的双字母(D)正方形。 However, the bottom double-letter (d) square was covered by the previous word and is, therefore, not counted again, per Scrabble rules. So, you'll need to make sure that the entries in the multiplier matrix are cleared out as they are covered with tiles. Each multiplier square counts for all the words scored in a turn (if more than one), but then is covered up for subsequent words.Write a function to calculate and return the total score for each player for the provided Scrabble boards using the accompanying multiplier matrices.Related problems:Previous problem: 7 - Multiplayer board scoring. Next problem: 9 - Optimal word score.
cat ip t poet cl there
乘数矩阵看起来是这样的:
t d t
d d d
第一个要玩的单词,itch,没有覆盖任何乘数平方,所以评分和通常一样。这里的第二个单词,除了底部中间的双字母(d)方块外,还包括了左下角的三个字母(T)方块。这意味着最后一个e翻了一倍(2分而不是1分),整个单词的分数是三倍。下一个要播放的单词apple覆盖了中间的双字母(D)正方形和上面的双字母(D)正方形。 However, the bottom double-letter (d) square was covered by the previous word and is, therefore, not counted again, per Scrabble rules. So, you'll need to make sure that the entries in the multiplier matrix are cleared out as they are covered with tiles. Each multiplier square counts for all the words scored in a turn (if more than one), but then is covered up for subsequent words.
Write a function to calculate and return the total score for each player for the provided Scrabble boards using the accompanying multiplier matrices.
Related problems:
Previous problem: 7 - Multiplayer board scoring. Next problem: 9 - Optimal word score.
不错的系列补助金
伟大的问题。尽管如此,我只意识到分数为零的空白瓷砖被包括在内(例如测试套件编号为0。3有阶(3)= {[3,3;3,7]}代表单词“this”,在结尾有空格。)在我最初的解决方案失败后。:)
N-Cards问题
解决145
找到非旋转多米诺骨牌的完美位置(更容易)
解决302
转换为二进制编码的十进制
解决108
求二进制加法器的和和进位
解决955
质数字母=移除
解决83
组合年龄2 -对称,n≥3
解决99
自相似性1 -每隔一项
44岁的解决者
熄灯6 - 5x5, 13步
解决13
熄灯2 - 5x5, 4步
17日解决
自相似性2 -每三项
解决42
在MATLAB Central中找到宝藏,并发现社区如何帮助您!
选择网站
选择一个网站,在可用的地方获得翻译的内容,并查看当地的活动和优惠。根据您所在的位置,我们建议您选择:.
您也可以从以下列表中选择一个网站:
选择中国站点(中文或英文)以获得最佳站点性能。其他MathWorks国家站点没有针对您所在位置的访问进行优化。
联系当地办事处