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, 22.06.2019 15:30
Melissa needs to add a topic to an email that she will send to her teacher. choose the name of the field where she should type her topic.
Answers: 2
question
Computers and Technology, 22.06.2019 22:00
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass.cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array.c . run this program and observe the results.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
This isn't about school but every time it tells me to watch an ad to unlock the answer to a question it prompts a survey and it just keeps loading. so i haven't been able to get answers for my tests in like a week.
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, 05.08.2019 01:50
Questions on the website: 13722367