Appearance
CS101 Word Game: Guess The Word
python
import guesstheword1.MyWordGame as wg
words = wg.WGLib.parseWordsFile('lowerwords.txt')
wg.startSession(words)Brief Description
I have implemented Guess The Word, a console word game reminiscent of NY Times' Wordle. The goal is to come up with the correct word within the given number of guesses, chosen by the player. For each guess, the game provides clues for which letters are in the word or in the correct position.
Settings
At game start, the player is prompted for one setting:
- Length: The player may enter any integer between 3 and 12, denoting the number of letters in the secret word that they will have to guess. The total number of turns the player gets is equal to the length of the word.
Rules of Play
The game consists of a fixed number of guesses that the player gets (the total number of guesses allowed is equal to the length of the secret word, a game setting chosen by the player at the start). The goal of the game is to guess the secret word by the last turn. A score of 0=lose, 1=win. When the game begins, the program randomly selects a secret word from the word list 'lowerwords.txt' that is equal to the desired word length that the player had input at the start.
For each turn, the player enters a guess of the same length as the secret word. A guess 'g' is valid if and only if: 'g' is the same length as the secret word 'g' must be a word found in the given word file, 'lowerwords.txt'. 'g' must not have already been guessed before (If a guess is invalid, the player is asked to re-enter a valid value)
After each guess 'g', the game provides feedback for each letter in the word. $: Correct letter, correct position. *: Correct letter, wrong position.
: Letter is not in the word at all.
The player automatically wins if they guess the secret word! If the player runs out of turns without guessing the secret word, the player loses the game, and the secret word is revealed. The player's win or loss is displayed at the end. If the player won, 'Congratulations, you won! Your score is 1' is displayed. If the player lost, 'Your word was (secret word) and your score is 0' is displayed.