In the Skeleton Program, AllowedWords contains the list of valid words that have been read in from the Data File aqawords.txt.
Example If the user enters the word TOO they will be awarded points for the valid words TOO and TO as TO is a prefix of the word TOO. They will not be awarded points for the word OO even though it is a valid word and is a substring of TOO because it is not a prefix of TOO.
Example If the user enters the word BETTER they will be awarded points for the words BETTER, BET and BE as these are all valid prefixes of the word entered by the user. They would not be awarded points for BETT or BETTE as these are not valid English words. They would not be awarded points for BEER as even though it is contained in the word BETTER it is not a prefix.
Example If the user enters the word BIOGASSES they will be awarded points for the words BIOGASSES, BIOGAS, BIOG, BIO and BI as these are all valid prefixes of the word entered by the user. They would not be awarded points for BIOGA, BIOGASS or BIOGASSE as these are not valid English words. They would not be awarded points for GAS as even though it is contained in the word BIOGASSES it is not a prefix.
Example If the user enters the word CALMIEST they will not be awarded any points as even though CALM at the start is a valid word the original word entered by the user, CALMIEST, is not.
Example If the user enters the word AN they will be awarded points for the word AN. They would not be awarded points for A even though A at the start is a valid word as points are only awarded for words that are at least two letters long.
What you need to do
Task 1 Write a recursive subroutine called GetScoreForWordAndPrefix that, if given a valid word, returns the score of the word added to the score for any valid words that are prefixes of the word.
To get full marks for this task the GetScoreForWordAndPrefix subroutine must make use of recursion in an appropriate way to calculate the score for any prefixes that are also valid words.
If your solution uses an alternative method to recursion you will be able to get most but not all of the available marks for this question.
Task 2 Modify the UpdateAfterAllowedWord subroutine so that it calls the new GetScoreForWordAndPrefix subroutine instead of the GetScoreForWord subroutine.
Task 3 Test that the changes you have made to the program work:
run the Skeleton Program
if you have answered Question 8, enter 15 when asked to enter the start hand size; if you have not answered Question 8 yet then skip this step
enter 2 at the main menu
enter the word abandon
enter 4 so that no tiles are replaced.