LAB 1 – A game of Hangmen
CSC 3391 – Spring 2022 – Lab 1
Game of Hangman
1. Work with multiple processes
2. Become familiar with Inter-Process Communication
3. Gain experience with an IDE
Due: Wed. March 2, 2022 10:00 PM (via Blackboard); Must demo on Monday March 7, 2022 (5% for demo)
Format: lab will be done individually.
Grade: 15% of your course grade (12% for lab, 3% of demo)
For Lab 1 you may use any operating system that you prefer however a version of Windows might be easier due to more availability of tools and online support.
You may write the program in any language that is supported under any Integrated Development Environment (IDE). Keep in mind that more help may be available to you in some languages than in others. You will be asked to demo your lab in class, the demo will be 20% of the lab grade (must demo regardless of the working status).
You are to implement a game of Hangman. Your implementation should consist of three processes. Each process must have a visible GUI window as it runs. The main process is the manager. The manager process should start the other two (player1 & player 2) processes and manage the game. The player processes may be two copies of the same program. Use whatever mechanism you wish to coordinate among the manager and the player processes (e.g. shared memory, pass messages, use a shared file, etc.). You can check with the Windows Task Manager to make sure that three processes have indeed been started. You must include enough information in the displays of the player processes to convince me that the three processes are communicating.
The manager will randomly select a word for the players to guess. You can build a small table of words into the game if you wish. Games on the web typically have a vocabulary of 50K words or so. The words should be fairly long for a real game, but for purposes of easy debugging you might want to have a table of 20 words with shorter word length (i.e. no more than 4 letters, such as “CAT”, “BOOK”, …). The manager process will then call each of the player processes per the rules of the game so that they can make a move. The player processes will display to the user a series of underscore characters to show the user how many letters are in the word. For example, if the word were “CAT” then the player would initially show “_ _ _” to the user. The users try to guess the word by guessing one letter at a time. The player process will report the letter guessed to the manager, and the manager will check to see if the letter occurs one or more times in the word. If the letter guessed by the player is correct then the word is displayed to the user with that letter filled in. For example: “_ A _”. That user then gets another guess. Incorrect guesses are tracked by having the manager draw a “hangman”. The hangman that is drawn has five parts. It might look like this:
The manager will originally display gallows that has a rope dangling from it (or a simple letter “O”). As the players make incorrect guesses the manager draws one part of the hangman at a time. At that point, it will be the other player’s turn to guess, and he will be shown the word with all the letters filled in that have been correctly guessed so far. If the hangman is completed by a wrong guess, then the manager decides that the two players are not going to guess this word and starts a new game. If one player guesses the last letter of a word, then he gets one point. The first player to get 5 points wins the game.
When the game ends, the manager should ask the first user if he wants to play again or exit. If the user wants to play again then the two player processes should be able to realize this is a new game starting and play again. If the user chooses not to play again then the manager process should notify the player processes and they should shut down in an orderly way.
You should submit a write-up which should include any known bugs and limitations in your programs. If you made any assumptions, document what you decided. This write-up should be submitted along with your code. Ideally, your program will be written with Visual Studio and I will be able to use the instructions in your write-up to run your program without your being there.
You should ZIP your source files, executable and write-up into a single file and submit via blackboard. Be sure that you include everything necessary to unzip this file on another machine and compile and run it. This might include forms, modules, classes, configuration files, etc. Please do not include system development environment components such as VB or Java runtime system with code. Please name your submitted zip file as:
Please make sure your names and your student IDs are listed in your write-up, and in a comment in your source code. Late submissions will be accepted at a penalty of 10 points per day. This penalty will apply regardless of whether you have other excuses. If your program is not working by the deadline, send it anyway and review it together for partial credit. Do not take a zero on any lab just because the program isn’t working yet. Feel free to research the web on resources however do NOT copy other people’s work.
This lab will be 15% of your course grade (10% for the work, 5% for demo of a working lab). The following point distribution will be used when grading:
10 Multiple player processes started successfully by the manager
20 GUI interface for each process working as required
20 Successful control of processes and communication of game information
05 Manager correctly processes words with duplicate letters
10 Play next game with the same running processes
10 Termination of player processes before manager process exits
05 Good Write up file and Comments in code
20 Lab demo
10 Use a graphic element to display the hangman on the manager.
5 Extra point for the course for the best lab (lab must be fully functional)
You may discuss the problem definition and tools with other students. You may discuss the lab requirements and the project design. You may assist one another in debugging. You may not discuss or share code and implementation. You may use any book, WWW reference or other people’s programs (but not those of other students in the class) as a reference as long as you cite that reference in the comments. If you use parts of other programs YOU MUST CITE THOSE REFERENCES. If we detect that portions of your program match portions of any other student’s program it will be presumed that you have collaborated unless you both cite some other source for the code. You must not violate university laws or professional ethics.
Page 1 of 3