Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please provide the python code script so that I could run and understand how's it working. Thank you. Introduction Scrabble is a board game in

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
please provide the python code script so that I could run and understand how's it working. Thank you.
Introduction Scrabble is a board game in which players take turns spelling words for points. Each letter has a point value. word scores are made up of the sum of letter scores, and multipliers can be applied if a letter or word lands on particular spaces on the board (as shown in the figure below). Different letters are worth different numbers of points in Scrabble. The distribution of these letters is given in this Wikipedia article we will use the English letter distribution. You will need to write a Python function that when given a letter, returns the number of points associated with that letter. For example, the letter A is worth 1 point, whereas the letter Z is worth 10. Points are scored in Scrabble by playing words. The score of a word, absent any multipliers (described below) is the sum of its letters points. For example, the word APPLE would score 9 points. A standard Scrabble board 99 DS A standard Scrabble board 9gVdS TOUR S DO TE KO C, co Moet DO DOVE Ri SCORE HOME SCORE 10 DO DO TEE COM Do WO WORD 1 ONE E WOOD D B, B B DOUS kou B DO L. ** A E NO ner scores werages luation Multipliers if a word crosses any of the coloured spaces on the game board, letter or word scores can be doubled or even tripled. For the purposes of this assignment, we will only consider word multipliers, which are: Triple word score Locations (0,0), (0.7).(0,14). (7.0). (7.7). (7.14), (14,0). (14.7). (14,14) Double word score Locations (1.1) (1, 13), (2.2), (2, 12), (3,3), (3. 11).(4.4). (4, 10). (10,4), (10,10). (11,3), (11,11) (12,2), (12.12). (13.1). (13.13) Thus, if the word APPLE is played from left to right at location (0.6);it will be worth 27 points (93) because one of its tiles is on a triple word score tile at (0,7). As another example, if the word python is spelled from top to bottom at location (2.0). it should score 42 points (143) because one of its tiles is on a triple word score til at (7.0). ores Double word score Locations (1.1). (1.13), (2.2), (2, 12), (3,3), (3, 11).(4.4). (4, 10). (10,4). (10, 10) (11,3), (11,11) (12,2), (12. 12), (13,1). (13, 13) Thus, if the word Apple is played from left to right at location (0.6), it will be worth 27 points ( 93) because one of its tiles is on a triple word score tile at (0,7). As another example, if the word prhon is spelled from top to bottom at location (2.0). it should score 42 points (14 * 3) because one of its tiles is on a triple word score tile at (7.0) sation 0 1 2 3 4 5 2 P 0 1 2 P 3 Y 4 T 5 H 6 N Requirements In this assignment, you must implement two Python functions, one to compute the score of a single letter and one to compute the score of a word. Single letters Use the points distribution referenced above to implement the following Python function: def letterscore letter): This function should return the number of points scored by playing the letterlatter I replace that your own For example, A should return 1 and incorect should return 10 Requirements In this assignment, you must implement two Python functions, one to compute the score of a single letter and one to compute the score of a word. Single letters Use the points distribution referenced above to implement the following Python function: def letterscore letter): This function should return the number of points scored by playing the letterlatter I replace that your own For example, A should return 1 and incorect should return 10 Single letters Use the points distribution referenced above to implement the following Python function: det letter_score(letter) This function should return the number of points scored by playing the letter letter pass replace this with your own work For example, letter score() should return 1 andi letter_scorec z should retum 10. Words Use the description above to complete the following Python function that calculates a word's point value. Words Use the description above to complete the following Python function that calculates a word's point value def word_score[word, row-None, col-None, direction-None) Compute the points that will be scored if a player plays this word. Parameters: word row col the word to be played which row the word will be played at (or None) which column the word will be played at or Mone) LR for left to right, 18 for top to bottom or Mone direction pass Front this with your own world If any of our calor afection are on all of them should be this means that you can ignore the word's If any of row.col or direction are None, all of them should be; this means that you can ignore the word's placement. For example, the function call word_score("APPLE") should evaluation to 9. If any of row, color direction are non-one, however, they should all be. In this case, you should take them all into account and apply any appropriate multipliers. For example, word_score('APPLE, 8, 6, "LR") should evaluation to 27 (as described above). Completing the assignment Implement the two functions above and submit your work in a file called scrabble.py. You may start by copying the stub implementations above into your Python file to help you get started. Then, follow our usual problem-solving approach (problem, pseudocode, Python) for each part of the assignment (letters, words. words with positions). I suggest that you work on one part at a time 1. First, Implement teton kore 2. Next, Implement while ignoring, sol and direction 3. Finally, take cool and in into account within Requirements In this assignment, you must implement two Python functions, one to compute the score of a single letter and one to compute the score of a word. Single letters Use the points distribution referenced above to implement the following Python function: def letterscore letter): This function should return the number of points scored by playing the letterlatter I replace that your own For example, A should return 1 and incorect should return 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions