0% found this document useful (0 votes)
204 views

Project

This document is an internship report submitted by a student to fulfill requirements for a Bachelor of Engineering degree. It describes a Hangman game project created using Python. The report includes sections on introduction, literature review, methodology, flowchart, sample code, output screens, conclusion and future enhancements. It provides an overview of the student's internship work developing a Hangman game application.

Uploaded by

sup
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
204 views

Project

This document is an internship report submitted by a student to fulfill requirements for a Bachelor of Engineering degree. It describes a Hangman game project created using Python. The report includes sections on introduction, literature review, methodology, flowchart, sample code, output screens, conclusion and future enhancements. It provides an overview of the student's internship work developing a Hangman game application.

Uploaded by

sup
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

“HANGMAN PROJECT”

AN INTERNSHIP REPORT

Submitted in partial fulfillment of the


Requirement for the award of the degree of

Bachelor of Engineering

In

Computer Science and Engineering

Under the guidance of

Ms.Nandhini S

Sr Project Manager

Department of Computer Science and Engineering


MATRUSRI ENGINEERING COLLEGE
SAIDABAD – 500 059

November 2022

1
MATRUSRI ENGINEERING COLLEGE

SAIDABAD – 500059

Department of Computer Science and Engineering

DECLARATION BY THE CANDIDATE

I, hereby certify that the internship project report entitled “HANGMAN


PROJECT” is submitted in the partial fulfillment of the required for the award of the
degree of Bachelor of Engineering in Computer Science and Engineering.

This is a Record of bonafide work carried out by me under the guidance of Ms.
Nandini. The results embodied in this report have not been reproduced/copied from
any source. The results embodied in this report have not been submitted to any other
university or institute for the award of any other degree or diploma.

Dept. of CSE,
MECS

II
ABSTRACT

This is a simple Hangman game using Python programming language. We can use this
as a small project to boost their programming skills and understanding logic. The
Hangman program randomly selects a secret word from a list of secret words. The
random module will provide this ability, so line 1 in program imports it. Hangman is a
popular word game in which one player (the "chooser") chooses a secret word and
another player (the "guesser") attempts to guess the word one letter at a time. If a
guessed letter appears in the word, all instances of it are revealed. If not, the guesser
loses a chance. If the guesser figures out the secret word before he or she runs out of
chances, he or she wins. If not, the player who chose the word wins.

III
TABLE OF CONTENTS

S.NO Contents Page No.

1 Introduction

2 Literature Survey

3 Methodology of the project

4 Flowchart

5 Sample code

6 Output screens

7 Conclusion

8 Future Enhancements

9 References

IV
1.INTRODUCTION:

Hangman is a guessing game for two or more players. One player thinks of a word, phrase or
sentense and the other(s) tries to guess it by suggesting letters within a certain number of guesses.
Originally a paper-and-pencil game, there are now electronic versions. Hangman is a guessing game
which is represented with a set number of dashes. The dashes consisted of unknown words and the
clues. It involves the progressive drawing, a line for each incorrect answer. Hangman game played
by two or more people that consist a host and players. The players guess letter by letter, while the
host draw the part of hangman.
This game focus on spelling, pronunciation and vocabulary. Wiratania (2018), Hangman game can
be used to enlarge vocabulary mastery, practice spelling, and trained students’ concentration. This
game helps teacher in controlling classroom. While the students are playing Hangman game in the
classroom, the teacher observes the process of acquiring vocabulary .Vocabulary is the fundamental
element for language learners. It is the basic resource for any language classes. Vocabulary has the
greater role that supports all language skills. The learners will speak, listen, read and write well if
they have sufficient numbers of vocabularies. By knowing many vocabularies, learners will be able
to comprehend reading materials, catch other talking, give responses, speak fluently and write
various topics. Students cannot compose a sentence in writing and speaking without vocabulary.
Students will find difficulty to understand what they read and listen with poor vocabulary. As a
consequence, students should master an adequate number of vocabulary and they must learn the
forms and the meanings of words. Therefor, developing students’ vocabulary should be taken into
consideration.

1.1Existing System:
 Hangman game was Originally a Paper-and-pencil game.
 One player thinks of a word, phrase or sentence and the other tries to guess it by suggesting
letters within a certain number of guesses. 

Disadvantages:
 It Cannot Be Played Alone 
  It Tends to Limit Academic Progress
 Does not Foster Technological Growth
1
 It might be boring to go with this version.
1.2 Proposed System:
 Thus, I proposed an GUI version.
 The main advantage of this version of this game is to widen the thinking capacity of the
player as the player comes across a lot of words he/she might not know.
 In my version of game I have include Graphical User Interface that might boost the player.

Advantages:
 They can be used as an educational tool for children or adults, and they’re great for helping
people build their vocabulary skills.
 This game  can help you improve your memory skills and think more creatively.

2
2.LITERATURE SURVEY:

Though the origins of the game are unknown, a variant is mentioned in a book of children's games
assembled by Alice Gomme in 1894 called Birds, Beasts, and Fishes.[1] This version lacks the image
of a hanged man, instead relying on keeping score as to the number of attempts it took each player to
fill in the blanks.

A version which incorporated hanging imagery was described in a 1902 Philadelphia Inquirer article,
which stated that it was popular at "White Cap" parties hosted by "Vigilance Committees" where
guests would wear "white peaked caps with masks".Vocabulary is one of the basic components of
language and there is no languages exist without words (Napa, 1990: 5). In order to communicate
well in English, children should get an adequate number of words and know how to use them
accurately. Vocabulary becomes an important aspect in learning English as a target language,
because it is the first basic important aspect in learning English. Besides that, it is impossible to be
successful in study a language without mastering the vocabulary. In this case, Kridalaksana (1993:
127) states that vocabulary is one of language components that maintain all of information about
meaning and using word in a language. In short, vocabulary is one of the important language aspects
which should be learned by language learners in order to be able to communicate. Besides that, the
more vocabulary which the learners have, it will be easier for them to develop and learn English as
the foreign language.

3
3.METHODOLOGY:

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.
In learning vocabulary, the young learners have to know the pronunciation and the spelling of new
vocabulary that they have already got. In this case, teachers need to make sure that both aspects are
accurately presented and learned in teaching English vocabulary (Ur, 1996: 60). Furthermore, Nisa
(2009, 61) asserts that hangman is one of teaching techniques which is used by the teacher in
teaching spelling to the young learners. This statement is in line with Ur (1996: 31) who affirms that
hangman game can be used as an exercise for young learners in spelling words. Here are the
following procedures of playing hangman game generally: a. One player thinks of a word and writes
down a series of dashes which represent the series of letter that make up the word. b. Then, the other
player guesses what the letters are. If they guess the right letter, the first player has to fill in the
relevant dash. If the guess is wrong, the first player may draw one component of drawing of a man
hanging on a gallow. The guesses continue until either the whole word has been guessed or hangman
drawing has been finished.

4
4.FLOWCHART

5
5.SAMPLE CODE

main.py
import pygame
from math import sqrt
import sys
from player import Player
from menu import draw_menu, pause, BACKGROUND_COLOR
from leaderboard import get_leaderboard
from board import Board
from game import Game

# Display variables
WIDTH, HEIGHT = 1200, 700
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('HANGMAN GAME')
pygame.init()

def main(player, surface):


    time_elapsed = 0
    board = Board(WIDTH, HEIGHT)
    game = Game(WIDTH, HEIGHT, 30, 20)
    game.draw_letters(player)
    clock = pygame.time.Clock()
    run = True
    while run:
        time_elapsed += clock.get_rawtime()
        clock.tick()

        if time_elapsed / 1000 > 1:


            time_elapsed = 0
            player.timer += 1

        for event in pygame.event.get():


            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    pause(WIN, WIDTH, HEIGHT, main, main_menu, get_leaderboard, player)
                elif event.unicode.isalpha():
                    for letter in game.letters:
                        x, y, ltr, visible, clicked = letter
                        if ltr == event.unicode.upper():
                            letter[4] = True

6
                            board.draw(surface, player, game, board)
                            pygame.time.delay(200)
                            letter[3] = False
                            game.guessed.append(ltr)
                            if ltr not in game.word:
                                player.lives -= 1
                                if player.lives == 0:
                                    board.draw(surface, player, game, board)
                                    pygame.time.delay(1000)
                                    board.draw_name(surface, player, board, main,
game.word, 'Lost')
                                    break
            elif event.type == pygame.MOUSEBUTTONDOWN:
                mouse_x, mouse_y = pygame.mouse.get_pos()
                for letter in game.letters:
                    x, y, ltr, visible, clicked = letter
                    if visible:
                        dist = sqrt((x - mouse_x) ** 2 + (y - mouse_y) ** 2)
                        if dist < game.radius:
                            letter[4] = True
                            board.draw(surface, player, game, board)
                            pygame.time.delay(500)
                            letter[3] = False
                            game.guessed.append(ltr)
                            if ltr not in game.word:
                                player.lives -= 1
                                if player.lives == 0:

                                    board.draw(surface, player, game, board)


                                    pygame.time.delay(500)
                                    board.draw_name(surface, player, board, main,
game.word, 'Lost')
                                    break

        board.draw(surface, player, game, board)

        won = True
        for letter in game.word:
            if letter not in game.guessed:
                won = False
                break

        if won:
            player.score += 10 * len(game.word)
            board.draw(surface, player, game, board)
            pygame.time.delay(500)
            board.draw_name(surface, player, board, main, game.word, 'Won')
            break

    pygame.quit()
7
    sys.exit()

def main_menu(surface):
    active = 1
    player = Player()
    run = True
    difficulties = ['LOW', 'MEDIUM', 'HARD']

    while run:
        surface.fill(BACKGROUND_COLOR)
        buttons = ['NEW GAME', f'LEVEL OF DIFFICULTY: {difficulties[player.difficulty -
1]}', 'LEADERBOARD', 'EXIT']
        draw_menu(surface, 'MAIN MENU', buttons, WIDTH, HEIGHT, active)
        pygame.display.update()

        for event in pygame.event.get():


            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_DOWN:
                    if active == 4:
                        active = 1
                    else:
                        active += 1
                elif event.key == pygame.K_UP:
                    if active == 1:
                        active = 4
                    else:
                        active -= 1
                elif event.key == pygame.K_RETURN:
                    if active == 1:
                        main(player, surface)
                    elif active == 2:
                        if player.difficulty == 3:
                            player.difficulty = 1
                        else:
                            player.difficulty += 1
                    elif active == 3:
                        get_leaderboard(surface, WIDTH, HEIGHT)
                    elif active == 4:
                        pygame.quit()
                        sys.exit()

    pygame.quit()
    sys.exit()

if __name__ == '__main__':
8
    main_menu(WIN)
        # Set Life as 7 (available Life is 6)
        self.lives = 7

Hangman_words.py

word_list = [
    'abruptly',
    'absurd',
    'abyss',
    'affix',
    'askew',
    'avenue',
    'awkward',
    'axiom',
    'azure',
    'bagpipes',
    'bandwagon',
    'banjo',
    'bayou',
    'beekeeper',
    'bikini',
    'blitz',
    'blizzard',
    'boggle',
    'bookworm',
    'boxcar',
    'boxful',
    'buckaroo',
    'buffalo',
    'buffoon',
    'buxom',

9
    'buzzard',
    'buzzing',
    'buzzwords',
    'caliph',
    'cobweb',
    'cockiness',
    'croquet',
    'crypt',
    'curacao',
    'cycle',
    'daiquiri',
    'dirndl',
    'disavow',
    'dizzying',
    'duplex',
    'dwarves',
    'embezzle',
    'equip',
    'espionage',
    'euouae',
    'exodus',
    'faking',
    'fishhook',
    'fixable',
    'fjord',
    'flapjack',
    'flopping',
    'fluffiness',
    'flyby',
    'foxglove',
    'frazzled',
    'frizzled',
    'fuchsia',
    'funny',

10
    'gabby',
    'galaxy',
    'galvanize',
    'gazebo',
    'giaour',
    'gizmo',
    'glowworm',
    'glyph',
    'gnarly',
    'gnostic',
    'gossip',
    'grogginess',
    'haiku',
    'haphazard',
    'hyphen',
    'iatrogenic',
    'icebox',
    'injury',
    'ivory',
    'ivy',
    'jackpot',
    'jaundice',
    'jawbreaker',
    'jaywalk',
    'jazziest',
    'jazzy',
    'jelly',
    'jigsaw',
    'jinx',
    'jiujitsu',
    'jockey',
    'jogging',
    'joking',
    'jovial',

11
    'joyful',
    'juicy',
    'jukebox',
    'jumbo',
    'kayak',
    'kazoo',
    'keyhole',
    'khaki',
    'kilobyte',
    'kiosk',
    'kitsch',
    'kiwifruit',
    'klutz',
    'knapsack',
    'larynx',
    'lengths',
    'lucky',
    'luxury',
    'lymph',
    'marquis',
    'matrix',
    'megahertz',
    'microwave',
    'mnemonic',
    'mystify',
    'naphtha',
    'nightclub',
    'nowadays',
    'numbskull',
    'nymph',
    'onyx',
    'ovary',
    'oxidize',
    'oxygen',

12
    'pajama',
    'peekaboo',
    'phlegm',
    'pixel',
    'pizazz',
    'pneumonia',
    'polka',
    'pshaw',
    'psyche',
    'puppy',
    'puzzling',
    'quartz',
    'queue',
    'quips',
    'quixotic',
    'quiz',
    'quizzes',
    'quorum',
    'razzmatazz',
    'rhubarb',
    'rhythm',
    'rickshaw',
    'schnapps',
    'scratch',
    'shiv',
    'snazzy',
    'sphinx',
    'spritz',
    'squawk',
    'staff',
    'strength',
    'strengths',
    'stretch',
    'stronghold',

13
    'stymied',
    'subway',
    'swivel',
    'syndrome',
    'thriftless',
    'thumbscrew',
    'topaz',
    'transcript',
    'transgress',
    'transplant',
    'triphthong',
    'twelfth',
    'twelfths',
    'unknown',
    'unworthy',
    'unzip',
    'uptown',
    'vaporize',
    'vixen',
    'vodka',
    'voodoo',
    'vortex',
    'voyeurism',
    'walkway',
    'waltz',
    'wave',
    'wavy',
    'waxy',
    'wellspring',
    'wheezy',
    'whiskey',
    'whizzing',
    'whomever',
    'wimpy',

14
    'witchcraft',
    'wizard',
    'woozy',
    'wristwatch',
    'wyvern',
    'xylophone',
    'yachtsman',
    'yippee',
    'yoked',
    'youthful',
    'yummy',
    'zephyr',
    'zigzag',
    'zigzagging',
    'zilch',
    'zipper',
    'zodiac',
    'zombie',
]

15
6.OUTPUT SCREENS:

16
17
18
19
20
8.FUTURE ENHANCEMENTS:

In future I want to extend this model by adding the meaning of the words that can be displayed along
with the word.Instead of the user searching the wrongly guessed word after the game, I would like to
add a module that can display the meaning also. I would also like to add the sound effect to the
game, so that it makes it more entertaining to the player and .This timer concept can also be
implemented in another way ,where the timer will be running and there will be a scoreboard that will
be displaying the position of the players as per the time taken.

21
7.CONCLUSION:

I conclude that the implementation of Hangman game contribute a significant enhancement to


strengthen young learners’ vocabulary. Word games are generally used as a source of entertainment,
but can additionally serve an education purpose. This project was a very interesting way to learn how
to use strings in python.

22
8.REFERENCES:

[1] “Python for everybody”, Charles R.Severance


[2] “Think Python”, Allen B.Downey
[3]”Python programming”, Mark lutz

23

You might also like