Project Smiley – Part II

Revision: 3/31/2008 7:42:59 AM

1214 Spring 08, Professor Wartell

Due: Sunday 4/20/08 11:00PM

Assignment: In this exercise, you write the second part of a simple game. This project builds on your code from Project 5. It adds additional game logical (more if/else structures) and decomposing your code into functions.

A working example of the final result for Project 6 is provided as

Project Smiley – Part II.exe

If you did not complete Project 5, you should make an appointment with the professor so that you can fix non-working parts of Project 5.

The program uses ASCII characters for all drawing as shown below. In the middle of the screen is an ASCII smiley face. The game screen has a border made of # characters.

Additions to original specifications:

·  [15pts] Draw approximately 50 periods (.) at random locations (but do not overwrite any # marks)

·  [15pts] Draw 10 astrix (*) at random locations (its ok to overwrite some .’s)

·  [10pts] Keep count of the number of .’s the face lands on while moving. This score is displays as Bits.

·  [10pts] Keep count of the number of *’s the face lands on while moving. This score is displayed as “Rotten Bits”

·  [5pts] When the face is positioned on a ., display the face as a face with its tongue sticking out:
:P

·  [5pts] When the face is positioned on a *, display the face as a frowning face:
:(

·  [5pts] When the face crashes, display the face as a ouch face:
:o

·  [5pts] If the user types in incorrect input:

1.  ignore the rest of the input line (use cin.ignore)

2.  display an error message

3.  ask the user to hit any key to continue

·  [15pts] Organize your program to use some of your own functions to help break up the program into pieces. You should use at least four functions as follows:

o  a function should draw the border

o  a function should draw all the bits

o  a function should move the face and handle the detection of what type of character the face is position over

o  a function should handle all the input command processing

These functions parameters may be a mix of pass by-value and/or pass by-reference. Details are up to you. Some functions may have lots of parameters.

Finally, 15pts are for having everything from Project 5 continuing to work properly in Project 6.

Total points is 100.

Hints:

·  You must check two x,y coordinates when testing for whether the face lands on a special character. (The location of the eyes and the location of the mouth).

·  Use the random number function discussed in class to position the Bits and Rotten Bits. Reset the seed (srand) to the same constant literal value every time you draw the Bits and Rotten Bits. This guarantees rand() generates the same locations every time the screen is redrawn.

Turnin: You should modify the contents of Project6.zip and then re-Zip the folder and turn in that re-Zipped folder with you additions. This folder must contain:

·  Project 6.sln - the MSVS 2005 solution file

·  Project 6.vcproj - the MSVS 2005 project file

·  all the .cpp and .h files –

·  Project 6.txt – an optional text file for any additional comments

The single .zip is uploaded to Blackboard. Code that doesn’t compile under MSVS 2005 will be heavily penalized up to receiving a zero.

NOTE: Be sure to adhere to the University’s Policy on Academic Integrity as discussed in class. Programming assignments are to be written individually and submitted programs must be the result of your own efforts.