0% found this document useful (0 votes)
50 views6 pages

Term Project - 2019

The document describes a programming assignment to create a Hangman game in Python. Students are asked to apply basic programming structures to develop an interactive Hangman game that runs in the terminal. The game must randomly select a word and allow the user to guess letters, tracking guesses remaining and letters guessed so far. Sample runs of both a winning and losing game are provided. Students will be graded on how well their program meets the specifications and outputs the desired results, and on the organization of their Python code. They must submit their code, at least four test runs, and a 500-word report by the given deadline.

Uploaded by

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

Term Project - 2019

The document describes a programming assignment to create a Hangman game in Python. Students are asked to apply basic programming structures to develop an interactive Hangman game that runs in the terminal. The game must randomly select a word and allow the user to guess letters, tracking guesses remaining and letters guessed so far. Sample runs of both a winning and losing game are provided. Students will be graded on how well their program meets the specifications and outputs the desired results, and on the organization of their Python code. They must submit their code, at least four test runs, and a 500-word report by the given deadline.

Uploaded by

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

DEPARTMENT OF COMPUTER & INFORMATION SYSTEMS ENGINEERING

BACHELORS IN COMPUTER SYSTEMS ENGINEERING

Course Code: CS-115


Course Title: Computer Programming
Complex Engineering Activity
FE Batch 2019, Fall Semester 2018

Course Learning Outcome


CLO 2: Apply basic programming language structures (Taxonomy level: C3).

Complex problem solving attributes covered (as per PEC - OBA manual – 2014)
 Range of resources: Involve the use of diverse resources (and for this purpose, resources include
people, money, equipment, materials, information and technologies).
 Level of interaction: Require resolution of significant problems arising from interactions between
wide-ranging or conflicting technical, engineering or other issues.
 Innovation: Involve creative use of engineering principles and research-based knowledge in novel

Problem Statement
Apply basic programming language structures to implement variation of the classic word game
HANGMAN in Python.

Description
Your application will allow the user to play hangman against the computer. The computer picks a word,
randomly form a list of available words, and the player tries to guess letters in the word. The player is
given a certain number of guesses at the beginning. The game is interactive; as the player inputs his/her
guess, the computer either:
 reveals the letter if it exists in the secret word
 penalize the user and updates the number of guesses remaining.
The game ends when either the user guesses the secret word, or the user runs out of guesses.

Game Rules and Interface


 The computer must select a word called secret word at random from the list of available words. A file
called word.txt is provided with this document that contains 55900 words in lowercase letters. This
file must be loaded at the start of the program.
 Users start with 6 guesses and 3 warnings.
 At the start of the game, let the player know how many letters the secret word contains and how many
guesses and warnings are remaining.
 The computer keeps track of all the letters the player has not guessed so far and before each turn
shows the player the remaining letters.
 Ask the player to supply one guess at a time. Immediately after each guess, the player should be told
whether the letter is in the secret word. Also, display to the player the secret word, with guessed
letters displayed and un-guessed letters replaced with an underscore and space (_ ).
 The game accepts both upper and lower case letters as valid guesses. If the player inputs anything
other than alphabets, prompt the user to enter valid input.
 If the player inputs a letter that hasn’t been guessed before and the letter is in the secret word, the
player does not lose any guesses or warnings.
 If the player inputs a consonant that hasn’t been guessed and the consonant is not in the secret word,
the user loses one guess if it’s a consonant.
 If the vowel hasn’t been guessed and the vowel is not in the secret word, the player loses two guesses.
 Each time the player inputs anything besides an alphabet (symbols, numbers) or a letter that has
already been guessed, the player loses a warning. If no warnings are left, the player loses a guess.
 The game should end when the player constructs the full word or runs out of guesses.
 If the player runs out of guesses before completing the word, tell them that the game has been lost and
reveal the word. The game ends.
 If the player wins, print a congratulatory message and tell the player the score calculated as follows:
Total score = number of guesses remaining x number unique letters in the secret word

Sample Test Runs


The red color below is only there to show you what the user typed in, as opposed to what the computer
output.

Winning Game
Loading word list from file...
55900 words loaded.
Welcome to the game Hangman!
I am thinking of a word that is 4 letters long.
You have 3 warnings left.
-------------
You have 6 guesses left.
Available letters: abcdefghijklmnopqrstuvwxyz
Please guess a letter: a
Good guess: _ a_ _
------------
You have 6 guesses left.
Available letters: bcdefghijklmnopqrstuvwxyz
Please guess a letter: a
Oops! You've already guessed that letter.
You have 2 warnings left: _ a_ _
------------
You have 6 guesses left.
Available letters: bcdefghijklmnopqrstuvwxyz
Please guess a letter: s
Oops! That letter is not in my word: _ a_ _
------------
You have 5 guesses left.
Available letters: bcdefghijklmnopqrtuvwxyz
Please guess a letter: $
Oops! That is not a valid letter.
You have 1 warnings left: _ a_ _
------------
You have 5 guesses left.
Available letters: bcdefghijklmnopqrtuvwxyz
Please guess a letter: t
Good guess: ta_ t
------------
You have 5 guesses left.
Available letters: bcdefghijklmnopqrtuvwxyz
Please guess a letter: e
Oops! That letter is not in my word: ta_ t
------------
You have 3 guesses left.
Available letters: bcdfghijklmnopqrtuvwxyz
Please guess a letter: e
Oops! You've already guessed that letter.
You have 0 warnings left: ta_ t
------------
You have 3 guesses left.
Available letters: bcdfghijklmnopqrtuvwxyz
Please guess a letter: e
Oops! You've already guessed that letter.
You have no warnings left so you lose one guess: ta_ t
------------
You have 2 guesses left.
Available letters: bcdfghijklnopquvwxyz
Please guess a letter: c
Good guess: tact
------------
Congratulations, you won!
Your total score for this game is: 4

Losing Game
Loading word list from file...
55900 words loaded.
Welcome to the game Hangman!
I am thinking of a word that is 4 letters long
You have 3 warnings left.
-----------
You have 6 guesses left
Available Letters: abcdefghijklmnopqrstuvwxyz
Please guess a letter: a
Oops! That letter is not in my word: _ _ _ _
-----------
You have 4 guesses left
Available Letters: bcdefghijklmnopqrstuvwxyz
Please guess a letter: b
Oops! That letter is not in my word: _ _ _ _
-----------
You have 3 guesses left
Available Letters: cdefghijklmnopqrstuvwxyz
Please guess a letter: c
Oops! That letter is not in my word: _ _ _ _
-----------
You have 2 guesses left
Available Letters: defghijklmnopqrstuvwxyz
Please guess a letter: 2
Oops! That is not a valid letter.
You have 2 warnings left: _ _ _ _
-----------
You have 2 guesses left
Available Letters: defghijklmnopqrstuvwxyz
Please guess a letter: d
Oops! That letter is not in my word: _ _ _ _
-----------
You have 1 guesses left
Available Letters: efghijklmnopqrstuvwxyz
Please guess a letter: e
Good guess: e_ _ e
-----------
You have 1 guesses left
Available Letters: fghijklmnopqrstuvwxyz
Please guess a letter: f
Oops! That letter is not in my word: e_ _ e
-----------
Sorry, you ran out of guesses.
The word was else.

Design Constraints
 You can add your own words to the file word.txt too. Till the time you study filing in class, you can
hardcode a word and start developing logic for the game.
 Organize your code in functions and files. Each function must be stored in a separate file.
 The code must be easy to read and follow.
 You can use any already implemented library functions.
 Try to make your print statements as close to the example game as possible.

Deliverables
 Submit names and roll numbers of your project group members on an A4 size sheet ( fill the last
page) , in Digital Design Lab latest by December 31st , 2019. You can work in groups of 4. Group
members must belong to one practical group.
 Submit Python code of the application, the .py files, latest by January 17, 2019 in a cd along with all
stuff specified in the next point.
 Prepare a report and submit it in Digital Design Lab latest by January 17, 2019. The report has to be
organized as follows:
o Title page. The rubric sheet given at the end of this document will serve as the title page of your
report.
o Text of 500 words at maximum, answering the following questions:
1. What are the distinguishing features of your project?
2. What was the most challenging part for you while working on the project?
3. Did you learn anything new in Python while working on this project?
o Hardcopy print of Python Code.
o Hardcopy print of at least 4 test case runs, including at least one winning and one loosing game.
DEPARTMENT OF COMPUTER & INFORMATION SYSTEMS ENGINEERING
BACHELORS IN COMPUTER SYSTEMS ENGINEERING
Course Code: CS-115
Course Title: Computer Programming
Complex Engineering Activity
FE Batch 2019, Fall Semester 2018
Grading Rubric
Group Members:
Student No. Name Roll No.
S1
S2
S3

Marks Obtained
CRITERIA AND SCALES
S1 S2 S3
Criterion 1: Does the application meet the desired specifications and produce the desired
outputs?
0–1 2-3 4–5
The application is The program produces correct The program works and
producing incorrect outputs but does not display them meets all of the
outputs. correctly. specifications.
Criterion 2: How well is the code organization?
0–1 2-3 4–5
The code is poorly The code is readable only by The code is well organized
organized and very someone who knows what it is and very easy to follow
difficult to read. supposed to be doing.
Criterion 3: How friendly is the application interface?
0–1 2-3 4–5
The application interface is The application interface is easy The application interface is
difficult to understand and to understand and but not that very easy to understand and
use. comfortable to use. use.
Criterion 3: How did the student answer questions relevant to the task?
0–2 3-7 8 – 10
The student answered few The student answered all
The student answered most of the
questions relevant to the the questions relevant to the
questions relevant to the solution.
solution. solution.
Criterion 4: Does the report adhere to the given format?
0–1 2-3 4–5
The report does not contain The report contains the required The report contains all the
the required information. information only partially. required information and
OR OR completely adheres to the
The organization of the The organization of the report given format.
report is poor. follows the given format only
partially.
Total Marks:

Teacher’s Signature:____________
Computer Programming Project Group Information

Project Title Hangman

Roll No. Name Email

Group Members

Date of submission:

Approved by

____________________
Practical Class Teacher

You might also like