More text file reading - the game of Scrabble
Let's quickly consider another example employing reading a text file.
|
In the game of Scrabble, each letter tile has a certain value -
the rarer a letter is in the English language,
the higher the value of that letter
('E' is common and has the value 1,
'Q' is rare and has the value 10).
Can we write C functions to determine:
- the value of a word in Scrabble?
- the word in a dictionary with the highest value?
- the best word to choose from a set of tiles?
|
In writing these functions we won't consider all of the rules of Scrabble.
Another consideration (which we'll ignore)
is that there are fixed tile frequencies -
for example,
there are 12 'E's but only 1 'Q'.
Refer to Wikipedia for the actual distributions.
|
|
CITS2002 Systems Programming, Lecture 7, p9, 12th August 2024.
|