< Back

Assignment 10

This is a pair optional assignment. You should create a directory called assignment 10 in cs170/assignments for this assignment. All code written for this assignment should be stored in that directory.

$ cd ~/cs170/assignments
$ mkdir assignment10 
$ cd assignment10 


Final Project

You have learned a lot over the course of this semester, so it is time for you to show everyone how much. This assignment is very open ended. So much so, that a description doesn't so much make sense. You can do essentially anything you want!


Details

This assignment is open ended, but there are a few restrictions:

  • The program must be written in C++.
  • The program must be interactive. Your program cannot simply perform some calculation. You can achieve this interaction by using input statements, using Qt's event handlers, or by reading from a file.
  • The program must be complex and interesting. I will determine whether a proposed project is complex and interesting. Please talk with me if you are unsure if your idea is sufficiently complex and interesting.


Proposal

You must write up a short (1-2 paragraph) description for your proposed assignment. You should make sure to describe:

  • The purpose of the program and what the program going to do.
  • The concepts you have learned this semester that will be used in your program.
  • Why you think your program is sufficiently complex and interesting to qualify as an assignment.
  • Why you think you can finish the project by the deadline.
This is due by the beginning of class on Wednesday, Apr. 19th.


Showcase

On Monday, April 24th 2017, We will have a showcase event during our final class period. During this time, you will be asked to give a breif demo of your project to the rest of the class. You should be prepared to answer questions about how your code works, and why you decided to undertake this project.

Grade

Grading for this assignment is slightly different than previous assignments. It will be graded according to the following criteria and percentages:

  • Functionality - 40%
  • Style - 40%
  • Proposal - 10%
  • Presentation - 10%

Extra

Bonus points may be awarded to programs that are viewed favorable by your fellow students. It is in your best interest to do your best!


Break Out

For those that do not know the game, Break Out is a game similar to Pong that consists of a user controlled paddle and a ball bouncing around the screen. Break Out also includes bricks (rectangles) at the opposite side of the screen as the paddle. When the ball bounces off of the bricks they disappear. The player wins the game by making all of the bricks disappear.


Details

The paddle should be on the bottom of the screen and only able to move laterally. There should be enough bricks to arrange them in a pattern at the top of the window. After the ball bounces off a brick, the brick should disappear. That is it should no longer be drawn and should no longer be checked for intersection with the ball. When all of the bricks have disappeared the program should display a congratulatory message.

You need to have at least two types of bricks in your game: Regular and Strong. Strong bricks should behave exactly like regular bricks as far as collisions are concerned. However, they should take multiple hits to break. These bricks should change color every time they are hit, so the user gets feedback on how many more hits a brick will take.

You will be required to use inheritance in this program. Remember that inheitance is great if there happens to be multiple classes that have attributes or behaviors that are shared between them. Examine the image above carefully. I chose the shapes for each of the pieces of the game very carefully to make inheritance work incredibly well for this program.

Note that the collision detection method covered in pong does not specify how to determine which side of a brick the ball collides with. A simple solution to this problem is to make the bricks wide but not very tall and to assume that all collisions are with either the top or bottom of the brick. Also note that that the collision detection method from lab can not determine which brick is hit first, if the ball is intersecting with multiple bricks. This can be a problem because if the ball does intersect with two bricks the result will be to change the velocity twice, and the ball will not bounce. A simple solution to this problem is to arrange the bricks so that it is not possible for the ball to intersect with multiple bricks simultaneously.


Evil Hangman

Normally in hangman, a word is selected that the player tries to guess one letter at a time. If the letter is in the word, all occurrences of the letter are revealed to the player. If the letter is not in the word, the player receives a penalty point. The game proceeds until the player either guesses the entire word or the penalty points reach a morbid threshold. That game is a little easy, if you have an effective strategy. You are going to create a version of hangman that cheats. It doesn't pick the word at the beginning, but rather in response to player guesses.


Details

You are going to create a command line version of hangman. Instead of picking a word at the beginning, like a typical game of hangman, a whole list of words are chosen. As the player makes guesses, you are going to whittle the list of words down, until either the player exhausts all of their guesses or they narrow down the list of possible words to just a single word.

Your program will read in a file of words, where the file is redirected into the program akin to how the Karplus Strong program worked. The user should then be allowed to pick how long of a word they would like to guess. Your program should read through the entire file of words, and add all of the words of the appropriate length to a linked list. This is now a list of all of the words your program could chose from, and still have a valid hangman game.

You are going to allow the user to make guesses at letters that could appear in the word specified. Remember that for a hangman game the user is going to have a limited number of guesses they can make. When the user makes a guess, your program should display whether their guessed letter appeared in their "word," as well as a list of all guesses made by the user. When the user makes a guess, you program is going to find the largest set of words that makes that guess still valid. It is going to do this by computing word families.

A word family is a set of words that have a specific letter in the same locations. For example, consider the following word list:

  boot boon pole bone hoot

There are two different word families for the letter O. One family is _ O O _, which are words that contain O as the second and third letters (boot, boon, and hoot). The other family is _ O _ _, words that contain o as the second letter (pole and bone). For words of length 4, there are a maximum of \(2^4\) possible word families:

  ____, ___o, __o_, __oo, _o__, _o_o, _oo_, _ooo, o___, o__o, o_o_,
  o_oo, oo__, oo_o, ooo_, oooo

In order to make the game as hard as possible, you want to keep the length of the linked list of words as large as possible. Every time the player guesses a letter, the program should compute the number of words in each word family, and pick the family with the largest size. You need to end up with a list which only contains words from the largest word family. The word family also defines the feedback to the user: If the user guessed 'o' for the above word list, the program would determine that the _ O O _ family was the largest, which means you inform the user that their word has two o's in the middle locations of their word.



Your program should include the traditional header, use appropriate variable names, and nicely label all values printed to the terminal. Submission are to be done through inquire.roanoke.edu through the Assignment 10 link. Both partners must submit through inquire!