Write a Turtle graphics program that plays the game of Hangman:
en.wikipedia.org/wiki/Hangman_(game) The program begins by picking one of the following names of famous computer scientists at random:
The player then guesses letters until he/she gets the answer right (and wins) or makes a total of six incorrect guesses (and loses). After each incorrect guess, a new body part is drawn: first the head, then the body, then the left arm, then the right arm, then the left leg and then the right leg: six incorrect guesses means that the player has lost. The space in each name is not considered part of the answer the user needs only to guess the letters.
Use a textinput window to take one letter at a time from the user. The user may enter a lowercase or uppercase letter as input, but the program should process all letters as uppercase. When the user guesses a letter correctly, the letter (or letters, if the letter is repeated in the word) should appear over its correct blank spot(s) in the word. If the user enters multiple letters at a single time, use only the first letter entered. You may assume that the user enters at least one letter and never enters nonletters.
The entire alphabet should also be drawn on the screen, with guessed letters shown in red, as in the examples below. If a user guesses the same letter a second time, a new body part should not be added and the second guess should not be counted against the user.
As part of this assignment you must define and call the following functions in your program where you feel it is appropriate to do so. You should decide what parameters make sense for each function to take:
You may define any additional functions you like, but you must write these four functions for full credit.
You will need to think carefully about what variables and data structures (e.g., strings, lists) you will need to complete the assignment. You might wish to make a list of letters to keep track of which letters the user has already guessed (both correctly and incorrectly guessed). Having this list would help you to decide which letters of the alphabet to draw in green and which letters should be drawn in red.
Naturally, you will also need to keep track of the users progress in guessing the final answer. This could be done with a string or a list. One idea is this: create a list containing a number of space characters equal to the length of the computer scientists name. For example suppose the correct answer is ALAN TURING. That string is 11 characters in length, including the space. So we make a list of 11 spaces: [" "," "," "," "," "," "," "," "," "," "," "] As the user makes correct guesses, the spaces are replaced with actual letters. For example, suppose the user has so far correctly guessed that A and N are in the answer. Then this list would contain the following: ["A"," ","A","N"," "," "," "," "," ","N"," "]
This is only one possible way to implement this data structure. Perhaps you will come up with your own!