Homework 3: Evil Hangman

Your Mission

You have discovered that your old hangman game was a bit too easy and all of the kids at school are making fun of you for it. You come up with a brilliant but very secretive idea: you are going to modify your game into a new version that you have appropriately named Evil Hangman.

Your Timeline

This assignment is due at 11:59 PM on Friday as listed on the course calendar via bSpace.

You absolutely must work with one other person on this assignment. Your partner may be from any section of CS10. You can ask around in lab or on Piazza to find a partner.

Assignment Details

Evil Hangman is played in exactly the same way as the original game. In fact, the player should have no idea that they are not playing the original game. The difference, however, is that the computer is actually cheating to make the game as hard as possible for the player. The computer does not actually settle on a word until the very end of the game. It tries to keep the player in the dark for as long as possible. Instead of picking a word at the very beginning a la regular hangman, the computer chooses a word but readily changes to a different word if the player starts guessing letters correctly. 

A flowchart describing one possible approach below is available here.

The dialogue between the player and computer should look exactly the same as it did in your last assignment. In fact, it will probably be in your best interest to start from your project that you submitted as Homework 2. We have also provided a few word lists (see below), but you are welcome to use your own for testing if you prefer. You can test your program on the 2000 words list before convincing yourself that your program completely works. However, your homework submission must have the 1000 words list set as the default words list.

Your program should continue to switch letters as long as there are words available given the letters guessed and your code's choice of whether to keep words with that letter in a specific place or to discount all words with that letter in it. Note that you should not worry about making your program work as efficiently as possible since you will not be graded on your homework’s performance in terms of speed. You will only graded on correctness.

NOTE: A "letter pattern" refers the positions that will be revealed in a word if a particular letter is guessed. For example, _ p p _ _ is one way to represent the letter pattern for "p" in the word "apple." The idea here is that even after you revealed a letter, you may still be able to pick another word.

Remember that, when played well, it should be possible to win a game of Evil Hangman. The computer may not cheat!

Evil Hangman Gameplay

There are many slight variations on the game of Evil Hangman. Below is a video of the way Evil Hangman should be played. It includes an overview of the basic algorithm, and some examples.

Click here to watch a video of the gameplay.

Click here to view the slides used in the above video.

Starting Materials

––– Special Extra Credit Opportunity –––

There are a few options for earning extra credit on this assignment. If you would like to earn this particular type of extra credit on this assignment, you must format your Homework 3 in such a way as explained here. The extra credit you will receive for this falls under item 2 of the Extra Credit Opportunity section below.

You can either start with your submission for HW2 or our solution to HW2.

Using the HW2 solution, you will be given 3 different word lists and some blocks. A description of what you will find in your starter file is listed below:

Basic Requirements

In order to receive full credit, there are a few simple requirements which you must meet. Refer to this list as you complete your Homework 3.

  1. Your project must be completed in Snap.

  1. You may either start with your Homework 2 solution or with the starter file given to you.

  1. You must work in a group of 2. Your partner may be from any section of CS10.

  1. Your homework file and your and your partner’s name and SIDs must be submitted by the deadline on bSpace.

  1. There must be a clear way to start your program. Using the green flag is the recommended approach.

  1. Your file should have the 1000 words list set as the default word list.

  1. You must follow the basic Evil Hangman algorithm as outlined in the video, powerpoint slides, and flowchart. This includes making use of “pattern matching” to select a new word.

Homework 3 Submission Guidelines

You will submit your Homework 3 on bSpace to the Homework 3 assignment slot. Only one person from each group should submit your assignment.

Your submission must contain two items:

  1. Project File - This is the file with all your code. YOU MUST LABEL YOUR ASSIGNMENT: “Partner1_Partner2_HW3” replacing Partner# with each person’s first and last names.

  1. Partners Comment - In the bSpace assignment comment box, please write the names and SID’s of you and your partner. Here is a sample of what you should be doing:

  1. Extra Credit: If you are completing any extra credit (see below), please let us know which extra credit option you have chosen to do by leaving a note in the bSpace assignment comments box. (You must do this in order to receive any additional points!)

Tips and Thoughts

(These are not required, but may prove extremely helpful!)

  1. Check out the flowchart, video, and slides. They describe an algorithm for approaching evil hangman.

  1. You should be able to reuse a lot of code from your second homework. The main challenge for this homework will likely be in designing your algorithm instead of writing tons of new blocks, so be sure to decide how you want your program to work before you start programming.

  1. Don’t forget to comment your code in order to help you and your partner keep track of changes.

  1. Save early, save often. And keep backups!

  1. Try to keep your code clean and concise. Programmers have a rule called the DRY Rule: Don’t Repeat Yourself! If you’re looking for more experienced style points, look ahead to the Final project spec.

Extra Credit Opportunity

Extra credit is available for Homework 3! Please make sure to let us know if you are implementing extra credit by adding a comment beneath your list of your partner names and SIDs in the bSpace comments box when submitting your assignment.

  1. Make your Evil Hangman game as EVIL as possible. Check out the slides for some suggestions on how to make Evil Hangman more evil. Feel free to let us know if you have additional ways you’d like to make the game more evil.
  2. You may format your Homework 3 so that it can be automatically graded (by a computer). Click here to read the instructions for this option. 

(NOTE: Your Homework 3 assignment will still be graded by a human! This option is geared towards helping us develop new options for an online version of CS10.)

CS10: The Beauty and Joy of Computing -- HW3 -- Evil Hangman