$29.99
CS202: PROGRAMMING PARADIGMS & PRAGMATICS
Lab 4: Hangman in Perl!
Aim: Write a program to play a word-guessing game like Hangman.
Let’s get started!
o Create a directory structure to hold your work for this course and all the subsequent labs:
Suggestion: CS202/Lab4
Introduction
o The word to guess is represented by a row of dashes, giving the number of letters in the word.
o If the player suggests a letter which occurs in the word, it should write it in all its correct positions
o If the suggested letter does not occur in the word, it should draw one element of a hanged man stick
figure as a tally mark
o The game is over when:
The player completes the word, or guesses the whole word correctly – Player Wins!
Number of tries exceeds a limit (completes the hangman diagram) – Player loses!
Game Simplified:
o It must randomly choose a word from a list of words.
o It must stop when all the letters are guessed correctly.
o It must give them limited tries and stop after they run out.
o It must display letters they have already guessed (either only the incorrect guesses or all guesses).
Suggestions:
o If you are familiar with OOP in Perl, use classes whenever/wherever possible to imitate real world objects
o If not, then try to modularize your program as much as possible into meaningful subroutines
o First get a simple text version of your game correct!!
o Then try drawing the hangman as shown in the examples.
Examples:
Sample List of Words
"computer|radio|calculator|teacher|bureau|police|geometry|president|subject|country|en
viroment|classroom|animals|province|month|politics|puzzle|instrument|kitchen|language|
vampire|ghost|solution|service|software|virus25|security|phonenumber|expert|website|ag
reement|support|compatibility|advanced|search|triathlon|immediately|encyclopedia|endur
ance|distance|nature|history|organization|international|championship|government|popula
rity|thousand|feature|wetsuit|fitness|legendary|variation|equal|approximately|segment|
priority|physics|branche|science|mathematics|lightning|dispersion|accelerator|detector
|terminology|design|operation|foundation|application|prediction|reference|measurement|
concept|perspective|overview|position|airplane|symmetry|dimension|toxic|algebra|illust
ration|classic|verification|citation|unusual|resource|analysis|license|comedy|screenpl
ay|production|release|emphasis|director|trademark|vehicle|aircraft|experiment";
Submitting your work:
o All source files and class files as one tar-gzipped archive.
When unzipped, it should create a directory with your ID. Example: 2008CSB1001 (NO OTHER
FORMAT IS ACCEPTABLE!!! Case sensitive!!!)
o Source files should include the following: (Case-Sensitive file names!!)
Hangman.pl
Any other supporting or required files
o Negative marks for any problems/errors in running your programs
o If any aspect of the game / rules are confusing, make an assumption and state it clearly in your README file!
o README file should also have instructions on how to use/run your program!
o Submit/Upload it to Google Classroom
o Marks Allocation
Correct Text Version [10 points]
Graphic Version [+5 points]
Coding Style [2 points]
README [3 points]