Mini Project Stage 1

THE HANGMAN GAME

PROBLEM STATEMENT

Hangman is a paper and pencil guessing game for two or more players. One player thinks of a word and the other tries to guess it by suggesting the letters.The word to guess is represented by a row of dashes, giving the number of letters. If the guessing player suggests a letter which occurs in the word, the program writes it in all its correct positions. If the suggested letter does not occur in the word, the other player draws one element of the hangman diagram as a tally mark. The game is over when:

The guessing player completes the word, or guesses the whole word correctly.

HOW TO PLAY: Our code will generate a word which has to be guessed by the player. So,at the output screen will exist marked out blanks (short lines) for each letter of a word.Then the player will guess a letter. If that letter is in the word(s) then the project will write the letter at everyplace it appears, and cross out that letter in the alphabet. If the letter isn't in the word then we cross out the lifelines (which are usually a finite no. of chances) from the list. The player will continue guessing the letters until he can either solve the word (or phrase) or he will end up losing all the lifelines and he will be declared a LOSER.

So, it is basically a TWO PLAYER game.But in my project a single player plays the game and the rules are strictly followed by the programme.

THE STRATEGY OF THE GAME - GOALS and DELIVERABLES

In the English language, the 12 most commonly occurring letters in descending order are: e-t-a-o-i-n-s-h-r-d-l-u. This and other letter-frequency lists are used by the guessing player to increase the odds when it is their turn to guess. On the other hand, the same lists can be used by the puzzle setter to stump their opponent by choosing a word which deliberately avoids common letters or one that contains rare letters.

Another common strategy is to guess vowels first, as English only has six vowels (a,e,i,o,u, and y), and almost every word has at least one.

Thus the user wins if he can guess the word or else he is a loser.In this programming assignment I intend to implement the user interface by which the code takes input as letters of the word and checks for its presence. Also another task is to reduce the no. of chances (lifelines) one by one as the user keeps on guessing incorrect letters.

My mini project will obviously illustrate the above mentioned task , and if time permits I even intend to enhance the GUI front end by adding some more buttons ,messagebox,and labels.

SOLUTION DESIGN

The gaming code will mainly contain the class Hangman which will provide the list of good letters as well as the no. of chances given to a user.I am planning to use tkinter toolkit for GUI. Incorporation of some widgets will better the result screen , so that , the user can proceed in the game with no confusion. The overall architechture can be thought of having four main parts which consist of the following functionalities:-

1) Formulating a word list (with or without a hint) and store them in a data structure with the list of all 26 alphabets of English Language.

2) The actual method which does the logical reasoning , whether the letter exists or not , if yes , write it down at all the places else strike off a lifeline. This forms the main part of the code.

3)Final word to be displayed if guessed wrongly else, interactive message saying that "The Player is the winner"

4)Finally,the GUI coding , user interactive screen which will mainly prevail during the code output.

I am using the glib and gtk+ libraries which are already available.Also planning to utilize the built in classes and submodules of tkinter toolkit as and when required.

Implementation Plan

I have decided to use PYTHON language and specifically Tkinter toolkit for the GUI package. Initially I was confused between Tkinter and wxpython , as python itself is very new to me. But then,thought of utilizing the classes and modules of this package for my gaming environment. This game will mainly play with the 26 letters of the English language , so my input data will be just letters and as output the player comes to know whether he has won , or else if lost , what was the word which he missed to guess correctly.Thus , there will be a list of words in store with the program from which a player will be asked to guess a word. My estimated lines of code is 200 but it may be little more depending upon how much well I can program.I need 2 weeks time for the project as I am new to python and specially GUI code .Currently I have only done some homework about what my project will do , exactly what it will accomplish ,but I am yet to start with coding. I hope and will try my best to complete it before the scheduled deadline.



Testing/Evaluation Plan

For this particular game , there will not be any specific test case except that , I will have to check whether the code works correctly or not for the words which are to be guessed. Also , by giving wrong letters more than the number of chances , the user is declared the loser.
For example:-


Word: 	_ A N _ _ A N
Guess: 	H
Misses: 	e,i,o,s,t
 	
Word: 	H A N _ _ A N
Guess: 	R
Misses: 	e,i,o,s,t

Word: 	H A N _ _ A N
Guess: 	N/A
Misses: 	e,i,o,r,s,t

Guesser loses - the answer was HANGMAN.

Context

Hangman Game Strategies

The most common used English letter is 'e' so one better starts by guessing it. The 4 other vowels ('a', 'o', 'i', 'u') are next popular after 'e'. The other most commonly used letters are 't', 'n', 's', 'h', 'r', 'd' and 'l'.
Using these letter can give one better odds for guessing the word, but they can also decrease the level of fun while playing and not necessarily will help one win, but words that are less common like "rhythm" don't qualify for this strategy.

Utility of Hangman Games

Hangman is used often by teachers to practice spelling, vocabulary and just for fun. The most popular way to play hangman games offline is to draw blank letters for the chosen word on a paper or on the blackboard and let the players guess the letters. For each incorrect guess, another part of the man is drawn. If the picture is complete before the word is revealed the hangman game is lost and the character is hanged, if the word is revealed before the execution the game is won.

Justification:-

The hangman game illustrates how much with discretion one can make the best choice at each stage ... strategies rely on obligations being fulfilled in the future(player strives to win). I picked up this topic as it was a simple but prudent game to check the intuition and tactics of a player in guessing the word in very less time.It subtly judges the efficient thought process of the player well.In the perspective of coding also, I feel it was a proper project for me to experience python GUI for the first time.


Future Scopes and extensions of this project:-

This game can have varied applications in the context of word formations and puzzles.Its knowledge can be valuable to many other games like CROSSWORD PUZZLES, WHEEL OF FORTUNE,SCRABBLE.We can also have an investigation of very popular and commonly used letters in most of the words. Make a frequency distribution in graph out of it. The underlying mathematical concepts are Data Collection and Analysis,Presentation and Interpretation which can have lot of implications in language processing and study of graphs and testing conjectures.Also, we can find out that the most popular letter in the English language is "e". The letter frequency of all letters in the English language is: e t a o i n s r h l d c u m f p g w y b v k x j q z.