Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

A

MICRO PROJECT REPORT


On

“A Famous Game HANGMAN”

Submitted to

V.P.M.P. POLYTECHNIC, GANDHINAGAR


DEPARTMENT OF COMPUTER ENGINEERING

Prepared by

Subject Teacher: Developed by:

Mrs Kiran M Jha Mam Jimesh.P.Raval (226540307171)


Keshar.J.Prajapati(226540307159)

Tanish Darji(226540307023)
V.P.M.P. POLYTECHNIC
DEPARTMENT OF COMPUTER
ENGINEERING

CERTIFICATE
This is to certify that Mr. Jimesh.P.Raval. of
22CE1 class, Enrollment No. 226540307171 has
satisfactory completed his / her term work in SLP
(4330701) for the term ending in NOVEMBER 2023

Date:

Sign of Subject Teacher: Sign of H.O.D


V.P.M.P. POLYTECHNIC
DEPARTMENT OF COMPUTER
ENGINEERING

CERTIFICATE
This is to certify that Mr. Keshar.J.Prajapati of
22CE1 class, Enrollment No. 226540307159 has
satisfactory completed his / her term work in SLP
(4330701) for the term ending in NOVEMBER 2023

Date:

Sign of Subject Teacher: Sign of H.O.D


V.P.M.P. POLYTECHNIC
DEPARTMENT OF COMPUTER
ENGINEERING

CERTIFICATE
This is to certify that Mr.Tanish Darji of 22CE1
class, Enrollment No. 226540307023 has satisfactory
completed his / her term work in SLP (4330701) for
the term ending in NOVEMBER 2023

Date:

Sign of Subject Teacher: Sign of H.O.D


Acknowledgments

I would like to express my deepest gratitude to “MRS KIRAN.M.JHA ”


for their exceptional mentorship, insightful guidance, and unwavering
support. Their expertise and encouragement were invaluable in shaping
the direction and success of this project.
I am profoundly thankful to my [Family/Friends] for their continuous
support, patience, and understanding during this journey. Their
encouragement provided the motivation needed to overcome
challenges and strive for excellence.
This project stands as a testament to the collective support and
guidance I received, without which its completion would not have been
possible.

Warm regards,

Jimesh Raval(226540307171)

Keshar Prajapati (226540307159)

Tanish Darji(226540307023)
TABLE OF CONTENT
1 Introduction

2 Objective of the Game:

3 Rules of the Game

4 Example of Gameplay

5
Education value

6 PROJECT CODE

7 Conclusion
1. Introduction
Hangman is a classic word game that combines wit and
strategy. Its simplicity makes it accessible to all, while its
unpredictability keeps players on the edge of their seats.
Whether you're a wordsmith or just looking for a good
time, Hangman offers a delightful blend of suspense and
linguistic prowess.

This game has stood the test of time, transcending


generations and platforms. From pencil and paper to
digital interfaces, Hangman continues to captivate
players worldwide. Today, we'll unravel the mystery behind
this timeless game, exploring its objectives, rules, and
even delving into a simple Python implementation. Get
ready to unleash the fun of word guessing!

Whether played with friends, family, or on a digital


platform, Hangman's popularity lies in its ability to
entertain and engage. So, let's embark on this journey of
letters, words, and the thrill of unraveling the unknown. Get
ready to unleash the fun of word guessing with Hangman!
2. Objective of the Game:
Guessing the Hidden Word

he primary goal of Hangman is straightforward yet laden


with suspense and challenge. Players aim to unravel a
hidden word by suggesting letters one at a time. The
mystery lies in uncovering the letters that make up the
concealed word, turning it from a string of blanks into a
recognizable term.

The Challenge: Solving Before Running Out of Attempts

Herein lies the challenge – the race against the hangman's


noose. Players must guess the correct letters to complete
the word within a limited number of attempts. Each
incorrect guess brings them closer to the impending fate
of the hangman figure being fully drawn. The key is to
decipher the word before the last stroke is made, adding
an element of urgency and excitement to the game.

As we explore the rules and dynamics of Hangman further,


you'll witness how this simple yet thrilling objective
transforms into an engaging and entertaining experience.
Let's unravel the mystery, one letter at a time!
3. Rules of the Game
Letter Guessing: Players take turns suggesting one letter
at a time. Each guess is an attempt to uncover a part of
the concealed word.

Incorrect Guesses: Here's where the stakes rise. An


incorrect guess results in the gradual creation of the
"hangman" figure. With each misstep, a new element of
the hangman comes to life, illustrating the
consequences of an unsuccessful attempt.

Hangman Figure: The hangman figure typically consists


of distinct parts—head, body, arms, and legs. The
completion of this figure signifies the progression
towards the end of the game.
Limited Attempts: The challenge intensifies with a
constraint on the number of incorrect guesses allowed.
Players must strategically select their letters, as running
out of attempts leads to the culmination of the hangman
figure and, consequently, the end of the game.

These rules combine suspense, strategy, and a touch of


risk, making each turn a critical moment in the journey
to unravel the hidden word. With the stage set, let's
explore the components that bring the game to life!
4.Example of Gameplay
Initial State:

->Word: _ _ _ _ _ _

Attempts Left: 6

Player's Turn 1:

->Player guesses "P."

Correct! Word: P _ _ _ _ _

Attempts Left: 6

Player's Turn 2:

->Player guesses "R."

Incorrect! Word: P _ _ _ _ _

Attempts Left: 5 (Hangman: Head)

Player's Turn 3:

->Player guesses "T."

Correct! Word: PT _ _ _ _

Attempts Left: 5

Player's Turn 4:

->Player guesses "A."


Incorrect! Word: PT _ _ _ _

Attempts Left: 4 (Hangman: Body)

Player's Turn 5:

->Player guesses "O."

Correct! Word: PTO _ _ _

Attempts Left: 4,Player's Turn 6:

Player guesses "H."

Correct! Word: PYTHON

Attempts Left: 4

Outcome: Congratulations! The player successfully


guessed the word "PYTHON" before running out of
attempts.

This example demonstrates the iterative nature of the


game, where players strategically guess letters, respond
to feedback, and inch closer to unveiling the hidden word.
The interactive dance between player and program is
what makes Hangman an engaging and dynamic word-
guessing experience. Now, armed with this understanding,
let's explore the Python code that brings this
excitement to life
5.Education value

Beyond its entertainment value, the Hangman game


carries several educational benefits that make it a
valuable learning tool.

1. Vocabulary Enrichment:

Hangman is an excellent tool for expanding one's


vocabulary. Players encounter a diverse range of words,
prompting them to explore and learn new terms in the
process of guessing

2.Problem-Solving and Deduction Skills:

The game encourages the development of problem-


solving skills. Players must analyze the available
information, make strategic decisions about which letters
to guess, and deduce the most likely options to unveil
the hidden word.

Basic Programming Concepts (if interested in coding):

For those interested in coding, creating a Hangman game


introduces fundamental programming concepts. This
includes random word selection, user input handling,
conditionals, loops, and more. It serves as a practical,
hands-on exercise for beginners in programming.
6. PROJECT CODE
import random

def choose_word():
words = ['apple', 'banana', 'orange', 'grape', 'strawberry', 'wate
rmelon', 'pineapple']
return random.choice(words)

def display_word(word, guessed_letters):


display = ''
for letter in word:
if letter in guessed_letters:
display += letter + ' '
else:
display += '_ '
return display

def hangman():
word_to_guess = choose_word()
guessed_letters = []
attempts = 6

print("Welcome to Hangman!")
print(display_word(word_to_guess, guessed_letters))

while attempts > 0:


guess = input("Guess a letter: ").lower()

if len(guess) != 1 or not guess.isalpha():


print("Please enter a single letter.")
continue
if guess in guessed_letters:
print("You've already guessed that letter.")
continue
guessed_letters.append(guess)

if guess not in word_to_guess:


attempts -= 1
print(f"Wrong guess! Attempts left: {attempts}")

display = display_word(word_to_guess, guessed_letters)


print(display)

if '_' not in display:


print("Congratulations! You guessed the word!")
break

if '_' in display:
print(f"Sorry, you ran out of attempts. The word was
'{word_to_guess}'.")

hangman()
output like:
pineapple
Congratulations! You guessed the word!
7.Conclusion
Key Points:
Objective: The goal is to guess a hidden word by
suggesting letters, emphasizing the challenge of solving it
before running out of attempts.
Rules: Players guess one letter at a time, incorrect guesses
lead to the drawing of a "hangman" figure, and there are
limited attempts before the game ends.
Example Gameplay: We walked through a simple
example, showcasing the dynamic interaction between
the player and the program as they strive to uncover
the hidden word.
Educational Value: Hangman offers benefits such as
vocabulary enrichment, the development of problem-
solving skills, and an introduction to basic programming
concepts for coding enthusiasts

Consider exploring the visual elements of the game, such


as screenshots or diagrams, to enhance the
audience's understanding.
FUTURE SCOPE:
The future scope of the Hangman game holds exciting
possibilities, especially with advancements in technology and
changing gaming preferences. Here are several avenues for the
future development and evolution of the Hangman game:
->Digital Integration and Platforms:
->Educational Gamification:
->Adaptive and AI-Powered Hangman:

Refrences

"Hangman: The Classic Word Game." Encyclopedia Britannica.


https://www.britannica.com/topic/hangman-word-game
Parlett, David. The Oxford History of Board Games. Oxford
University Press, 1999.
Refence in SLP ch-2,3,4…(List,Function,If-else statement)
https://www.museumofplay.org/blog/play-stuff/2017/03/the-
history-of-hangman.
"python-docx Documentation." GitHub. https://python-
docx.readthedocs.io/en/latest

You might also like