This week we are going to be building a basic word game. This will require an understanding of string handling operations in your chosen programming language.
Write a program which asks the user to enter a word. The program should then calculate and output the user’s score based on the length of the word.
- 3 letters: 1 point
- 4-5 letters: 2 points
- 6-7 letters: 3 points
- 8-9 letters: 5 points
Add some validation to your program so that any words which are less than 3 letters long, or greater than 9 letters long are rejected. The program should then ask the user to re-enter their word until a valid word is entered.
The scoring system is to be expanded with the following rules:
- If the word contains four or more consonants, the user will score an extra 2 points
- If the word only contains one vowel, the user will score an extra 2 points.
A final rule is to be added to the game. If the word does not use the same letter more than once, the user will gain an extra 5 points. For example: WATCH would gain an extra 5 points as each letter is unique; however, FOREVER would not as the letter E is repeated.