slanted W3C logo
Cover page images (keys)

ANWESHA DAS

MINI PROJECT STAGE-2 REPORT

ROLL NUMBER - 09305913

DEPT-CSE MTECH 1 STUDENT

CS 699 LAB

SLIDE SHOW OF THE HANGMAN GAME

Dave Raggett, <dsr@w3.org>




Hit the space bar for next slide

PROBLEM STATEMENT - IMPLEMENTATION DETAILS

For handouts, its often useful to include extra notes using a div element with class="handout" following each slide, as in:

<div class="slide"> 
 ... your slide content ...
</div>

<div class="handout">
 ... stuff that only appears in the handouts ...

</div>

-- MOTIVATION-GENESIS --

  • The main motivation is to provide a multi-player text based game for children to help them practise writing.Originally was designed,keeping in mind the young children , but is appropriate for all age levels.
  • According to the Oxford Guide to Word Games, the game of Hangman dates back to the Victorian era (1837-1901), which means that people have recognised its benefits for many years. One could say it is the most basic form of crossword puzzle, given that the user is deciphering one word at a time, based on the letters available.
  • This classic word game can be a fun and a easy way to learn a Different Languages based on the wordlist.It will also helps to learn the vocabulary of the Language.It correctly demonstrates how great an attention grabber Hangman is!

  • WHY HANGMAN ??
  • If the focus is on listening comprehension, rather than the spelling vagaries of decontextualized words, as it usually is, it can be both fun and worthwhile playing Hangman. In order to keep students' motivation high, I find that it helps if the word or phrase is carefully chosen, perhaps topical, and will challenge the students.
  • USEFULNESS-- HOW DOES IT HELP IN REAL LIFE ??
  • Hangman is useful for teaching and revising spelling words or for boosting general knowledge. It can be used for common nouns, proper nouns (names of people and places) or perhaps have a famous quote and the ‘guessing’ players have to guess who said it to solve the puzzle.
  • Hangman is not only a game for children. It is equally popular with adults. The iconic game-show Wheel of Fortune is based on its principles. It is a great way to have our daily dose of mental stimulation increasing our vocabulary.

  • There are now many Hangman websites, where one can play online against one's self (or with others). This is also great fun and challenging. There are many number of topics to suit the user's taste.
    I have also made a similar attempt to implement the same.

    HANGMAN- A GREAT WORD GAME FOR ALL AGES

    PROPOSAL AND FINAL IMPLEMENTATION ->

    In my MiniProject stage I Report I had proposed

    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 have accomplished almost what ever I had proposed initially. I have successfully implemented the Diagram of Hangman game and the Logical Reasoning part which forms the most important part of the game.I didnot display for every guess whether the letter has been used already as I am highlighting the alphabet after every new guess.Also, I have excluded the "hint" portion form the game. I didnot implement the "hint question" as linking the words chosen randomly with a hint question was giving me problems initially.

  • I had also mentioned in my previous Report that
  • 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.

  • I have implemented the code in conformity to what I had planned. I didnot use a button for each alphabet , but for all the letters pressed if, that letter is contained in the word I add it to the list or else I ignore( if any other key, leaving the alphabet keys are pressed). My INPUTS and OUTPUTS are in accordance to what I mentioned before.
  • I have hardly added any extra features. It implements the classic functioning of the word guessing GAME.

    IF YOU ARE LOOKING FOR A GOOD WORD GAME TO PLAY, YOU REALLY CANNOT GO PAST HANGMAN !!

    TIME TO DEVELOP THE GAME--

    HANGMAN - A COMPLETE APPLICATION FROM START TO FINISH

  • The idea of this game is that the computer randomly selects one of several predefined words, and the player has to guess it . The basic Architechture of the system is as follows:-
  • 
     
  • The code contains one class class HangMan(Tk).
  • The various funtions of the class like showletter(), wordset(),binder() drawhangman(),shownext() functions are called accordingly for proper functioning of the Game.It is an event driven project in its entirity.
  • The binder funtion performs the event handling which is the key press, when ever an alphabet is typed through the keyboard it is checked and the required funtions are called to materialize the game. The corresponding letters of the keycode are also printed to the terminal for reference.

    My Detailed Solution Design contains the following features from input to output :-

    1. Entire code is contained within one class called HangMan.All the modules needed for the Tkinter GUI and other packages are imported.

    2. Next using the WIDGETS LABEL and BUTTON Welcome message is displayed and an exit option is also made to quit the GAME.
    3. The word list is made using the list built in class.Randomly a word is picked and given to the player to guess. This is proceeded by drawing the graph for the HangMan diagram using the canvas widget class of Tkinter. Its structured graphics to implement custom widgets  The drawhangman() is called which draws the HangMan Figure in white
    4. All the 26 alphabets of English Language are simply displayed for reference, to the left of the plot 10 each in a row using the label widget. No. of dashes correspongding to the letters of the word is displayed in the wordset().
    5. Now the most important juncture of the code binder defination implements the key press action event. A valid guess is a single character between a and z.  If user enters a lower-case letter, it is checked , if not contained in the word gives a message saying "wrong guess" The next part of the diagram is drawn in black.
    6. For any valid guess where the user guessed a new character,showletter() and marked letter()is called.
    7. After each turn, I display the current guess with one underscore ('_') character per letter of the word to be guessed for each unguessed character, and display the actual (capital) character of each guessed character.  Display a space between each character.  For example, for a three letter word, the display should initially show "_ _ _".  But if the middle letter has been guessed as a 'a', then it should show "_ a _".
    8. If the player enters a valid guess that has not been guessed before, then all characters in the word that equal that letter is exposed.  i.e., guessing 't' when the hidden word is "testt"displays "t _ _ t".
    9. The game ends under either one of two conditions:

      • The player correctly guesses the word, in which case, output is a congratulatory message or the player cannot guess the word i.e the total diagram of HangMan is drawn.
      • The player presses 'exit' before the he/she guesses the word.

  • IMPLEMENTATION DETAILS --- TOOLS and APPLICATIONS .

    The following Statistics give an insight of how I developed the project.

    
    

    CHALLENGES-- OVERCOMING HURDLES--

    I got stuck sometimes due to some indentation errors. There were no major hurdles as such implmenting the project.


    Checking the event handling, binding operation in command mode.

    Screenshots -- SAMPLE OUTPUTS

    The initial output screen is as follows:-



    After the "Ok" button it looks like



    For an incorrect guess the showinfo dialog is shown



    If the player wins



    And if the player loses



  • It can be very advantageous to play the Hangman Game as it has the ability to suit to all kinds of requirements and to all age groups.
  • It enhances our vocabulary tests memory power, also our intuitive power to correctly detect the word.
  • I now personally feel that implementation in Python is certainly simpler than other programming languages like JAVA, C++. Once the syntax the structure of the language is interpreted correctly , its not a very cumbersome task to implement a project.
  • The lines of code are also pretty less which will make it more robust and beneficial to many application programmers.
  • I also infer that longer words are easier to detect than shorter ones.
  • The frequency of the vowel e in any word is very high, also the player should try out the vowels first , and latter try with the consonants to win the game.
  • 12 most commonly occurring letters in descending order are: e-t-a-o-i-n-s-h-r-d-l-u.
  • FUTURE WORK


    The Hangman Game can be further extended to give the player hints. For each incorrect guess the player makes,the system tells him if the nearest character in the word is less then (closer to 'A') or greater than (closer to 'Z') the character they guessed.
    It can be even extended to offer the ability to play several games simultaneously with the same set of guesses.The game can start by asking the player how many games he wants to play at the same time. Then, for each character he guesses, that guess is applied to all the active games, and all the results are displayed at once. This code can be thought of to be implemented in a nice modularized fashion, so there could be some wrapper code that asks the play for their guess and supplies that guess to all hangman instances.


  • I will prefer implementing them in Python for ease of execution and simplicity of code.
  • I hope to enhance this simple game so that it can be generalized to a wider range of wordlists and features as mentioned above.

    
    
    

    These games are certainly popular, which is not enough,but as long as it is made sure that challenging yet accessible languages are provided, they should continue to be winners.

    THANK YOU