subject

You are working on developing an electronic version of Scrabble. You are tasked with writing a variety of functions to this end. scrabble. txt is available in the hw4.zipand is a sorted, sanitized version of the Tournament Word List used in the US and Canada and based on the Official Scrabble Players Dictionary. Your job is to write a menu-basedsystem, name your source code file scrabble. c, that does the following: (a) Given a word determine if the word is in the Scrabble dictionary or not.
While you could perform a linear search through the dictionary that strategy is inefficient. As the dictionary is sorted you can employ a binary search strategy to find if the word is in the Scrabble dictionary or not. Do not use C library's bsearch() function. You must write your own binary search function.
(b) Given a set of tiles determine the best play. That is given a set of tiles determine the first word that is encountered that produces the maximum value of points.
The best play does not need to use all the tiles. For instance, if you have the following tiles abcdefg, the best play is decaf with a value of 11 points. For a given set of tiles there are (probably) multiple words with the same value, you only need to return one best play which is the first best play you find. Make sure you allow for duplicate tiles. For instance, if the user enters ccaabb, the best play is bacca for 11 points. Report to the user the best play and the value the play is worth. Scrabble assigns the following values to letters:
Letter A B C D E F G H I J K L M
Value 1 3 3 2 1 4 2 4 1 8 5 1 3
Letter N O P Q R S T U V W X Y Z
Value 1 1 3 10 1 11 4 8 4 10
As both menu items depend on the Scrabble dictionary, your first task is to load the dictionary into memory as an array of pointers to strings. You do this by declaring char **words and then allocating space for each word in the dictionary on the fly. As you don't know how much space you need beforehand you will employ a doubling of memory technique to ensure you allocate enough space. In the tarball the file integers. c contains sample code for reading in a file of integers (test data) that demonstrates the doubling technique. The sample code leaks memory. Make sure you have no memory leaks in your code. Check with valgrind.
For any string copy operations use strncpyo.
\$ ./scrabble
Scrabble Menu
1. find if a word is in the scrabble dictionary
2. determine best play from tiles
3. quit
Enter an option [1, 2, 3]: 1 enter word: scrabble
scrabble is a valid scrabble word
Scrabble Menu
1. find if a word is in the scrabble dictionary
2. determine best play from tiles
3. quit
Enter an option [1, 2, 3]: 1
enter word:
zxyzxy zxyzxy is not a valid scrabble word
Scrabble Menu
1. find if a word is in the scrabble dictionary
2. determine best play from tiles
3. quit
Enter an option [1, 2, 3]: 2
enter tiles as a word: ryzyt
best play is 'try' (6 points)
Scrabble Menu
1. find if a word is in the scrabble dictionary
2. determine best play from tiles
3. quit
Enter an option [1, 2, 3]: 3

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:50
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
question
Computers and Technology, 23.06.2019 10:20
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
Write an expression that will cause the following code to print "equal" if the value of sensorreading is "close enough" to targetvalue. otherwise, print "not equal". ex: if targetvalue is 0.3333 and sensorreading is (1.0/3.0), output is:
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
Is a type of bullying that takes place when a person intentionally posts negative information about another person that is not true.
Answers: 2
You know the right answer?
You are working on developing an electronic version of Scrabble. You are tasked with writing a varie...
Questions
question
Mathematics, 20.07.2019 08:10
question
Mathematics, 20.07.2019 08:10
question
Social Studies, 20.07.2019 08:10
Questions on the website: 13722362