[go: up one dir, main page]

0% found this document useful (0 votes)
116 views8 pages

Dsa Project Report

This document describes a project report on implementing a Hangman game. It includes sections on functions, data structures, a flowchart, pseudocode, and a sample run. The game uses arrays to store the hidden word and guessed letters, linked lists to store possible words, stacks to track guessed letters, and hash tables to store letter frequencies. The pseudocode outlines initializing the game, getting letter guesses, updating the word and guesses, checking the game status, and displaying the result.

Uploaded by

Jia Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views8 pages

Dsa Project Report

This document describes a project report on implementing a Hangman game. It includes sections on functions, data structures, a flowchart, pseudocode, and a sample run. The game uses arrays to store the hidden word and guessed letters, linked lists to store possible words, stacks to track guessed letters, and hash tables to store letter frequencies. The pseudocode outlines initializing the game, getting letter guesses, updating the word and guesses, checking the game status, and displaying the result.

Uploaded by

Jia Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

COMPUTER SCIENCE DEPARTMENT

GROUP MEMBERS:

SYEDA JIYA ALI (21108185)

ABUL HASSAN ZAIDI

UZAIR TANVEER

PROGRAM: BS-AI

PROGRAM SECTION: BS-AI 3A

TOPIC: PROJECT REPORT (HANGMAN GAME)

COURSE INTSRUCTOR: MA’AM ANILA ZAWAR

COURSE: DSA LAB

BSAI-3A

Page 1
COMPUTER SCIENCE DEPARTMENT

TABLE OF CONTENTS
 INTRODUCTION
 FUNCTIONS
 DATA STRUCTURES
 FLOW CHART
 PSEUEDO CODE
 SAMPLE RUN

BSAI-3A

Page 2
COMPUTER SCIENCE DEPARTMENT

INTRODUCTION

Hangman is a classic word guessing game that can be implemented using data
structures and algorithms (DSA).
It is a popular word game that has been enjoyed by people of all ages for decades.
It is a game that tests your vocabulary, spelling, and guessing skills. The game's
simplicity and appeal have made it a classic that has endured through generations.
The game involves a player trying to guess a hidden word by suggesting letters one
at a time. With each incorrect guess, the player loses a life, and after a certain
number of incorrect guesses, the game ends. The goal of the game is to guess the
word before running out of lives.

FUNCTIONS

 Login(): The user will enter his credentials


 Start():The game will start with user having full lives.
 initialize_game(): To initialize the game by selecting a random word from
the list and setting up the necessary data structures.
 update_word(): To update the hidden word based on the letters guessed by
the player.
 update_guesses(): To update the list of guessed letters and the number of
lives remaining.
BSAI-3A

Page 3
COMPUTER SCIENCE DEPARTMENT

 Score(): The score method will keep a track of highest score.


 check_game_status(): To check if the game has ended (i.e., the player has
won or lost).
 Quit(): The Quit function will ask the user to replay or quit the game.

STRUCTURES

• Loops
• Conditions
• Functions
• Arrays
• Linked List
• Stacks
• Hash Tables
EXPLANATION:
 Arrays: to store the hidden word and the letters guessed by the player.
 Linked List: to store the words that can be used as the hidden word.
 Stacks: to keep track of the letters guessed by the player.
 Hash Tables: to store the letters and their frequency in the hidden word.

BSAI-3A

Page 4
COMPUTER SCIENCE DEPARTMENT

FLOWCHART

BSAI-3A

Page 5
COMPUTER SCIENCE DEPARTMENT

SAMPLE RUN:

HANGMAN
  +---+
      |
      |
      |
     ===
Missed letters:
___
Guess a letter.
a
  +---+
      |
      |
      |
     ===
Missed letters:
_a_
Guess a letter.
o
  +---+
  O   |
      |
      |
     ===
Missed letters: o
_a_
Guess a letter.
BSAI-3A

Page 6
COMPUTER SCIENCE DEPARTMENT

r
  +---+
  O   |
  |   |
      |
     ===
Missed letters: or
_a_
Guess a letter.
t
  +---+
  O   |
  |   |
      |
     ===
Missed letters: or
_at
Guess a letter.
a
You have already guessed that letter. Choose again.
Guess a letter.
c
Yes! The secret word is "cat"! You have won!
Do you want to play again? (yes or no)
no
 +---+    +---+    +---+    +---+    +---+    +---+    +---+
      |    O   |    O   |    O   |    O   |    O   |    O   |
      |        |    |   |   /|   |   /|\  |   /|\  |   /|\  |
      |        |        |        |        |   /    |   / \  |
     ===      ===      ===      ===      ===      ===      ===

BSAI-3A

Page 7
COMPUTER SCIENCE DEPARTMENT

PSUEDOCODE:
• Initialize the game by selecting a random word from the list and setting up
the necessary data structures.
• While the game is not over:
a. Ask the player to guess a letter.
b. Update the hidden word based on the letters guessed by the player.
c. Update the list of guessed letters and the number of lives remaining.
d. Check if the game has ended.
• Display the result of the game (i.e., whether the player won or lost).

BSAI-3A

Page 8

You might also like