CASE STUDY: JOTTO (spec.txt) JOTTO SPECIFICATION OVERVIEW Jotto is a simple word guessing game. In the computer version, the computer selects a secret word and the player tries to guess it. At each turn the player enters a guess, which is 5 letter word that has no repeated letters and doesn't end in the letter 's.' The computer responds by giving a hint indicating how many letters the guess and the secret word have in common. The game ends when the player guesses the secret word correctly, or after twenty turns. INPUT REQUIREMENTS Guess word: a five character string entered by the player at the keyboard. Secret words file: an ascii text data file of secret words, one per line. The number of words in the file may vary. OUTPUT REQUIREMENTS Title screen: Display showing title of game and brief instructions. Game play messages: Prompt for player input. Turn number. Hint. Won game message. Lost game message. Play again prompt. Invalid input messages. FUNCTIONAL REQUIREMENTS Program Startup 1. Display the title screen at the start of the game. 2. Select a random secret word from the secret words file. Playing the Game 3.1 Display the current turn number. 3.2 Display a prompt message which asks the player to guess the word. 4. Allow the player to type a guess word at the keyboard. The player must press the ENTER key before the program will proceed. 5. Validate the guess word. A valid guess must meet these criteria: 5.1. is at least 5 letters long. 5.2. Doesn't end in the letter 'S.' 5.3. contains no repeated letters (even non adjacent). 5.4. contains only characters between A - Z. 5.4. May be either upper or lower case. NOTE: In the real game, valid words may NOT be acronyms, abbreviations proper names, and MUST be english words. The computer, however, has no way of determining (with certainty) if these rules are followed, thus these rules will not be validated by the program. 5.5 Guesses which do not meet the criteria above cause an invalid input message to be displayed which echoes the user's input and identifies the rule which was violated. 5.6 Empty input lines are ignored. 5.7 Extra characters (more than 5) on a guess are ignored. 6. When a valid guess is entered: 6.1. Display the guess word. 6.2. Display a hint (an integer), which indicates how many letters are in common between the guess and the secret word. The hint does NOT pertain to position of the letters within the secret word. Ending the Game 7. If the player doesn't guess the secret word in 20 turns, 7.1. display a lose game message. 7.2. display the secret word. 8. If the player's guess matches the secret word, 8.1. display a won game message. 8.2. display the number of turns used. 9. After the display of the game outcome (win or lose), the player will be prompted if they want to play another game. The player enters upper or lower case 'Y' to indicate they want another game. Any other input means they don't want to play again. 9.1 If the user wants another game, the program begins again, starting with the title screen display. 9.2 If the user doesn't want to play again, the program terminates. ERROR HANDLING REQUIREMENTS 10. If the secret word data file can't be found, display an error message and proceed using a default secret word. 11. Assume all words in the data file are the proper length (5). Display a warning message if a word is encountered which is not a valid word, ignore the word and proceed. USER INTERFACE REQUIREMENTS 12. The player should be able to view all previous guesses and hints on the screen at one time. OTHER REQUIREMENTS 13. The following undocumented "Cheat" features are intended to facilitate software verification. 13.1 Entering a guess of "QUIT" causes the program to go to the play again prompt. 13.2 Entering a guess of "#####" causes the secret word to be displayed in the upper right corner of the screen.