Spring2015.CSCI220Homework3 History

Show minor edits - Show changes to output

Added lines 11-12:
This is a '''pair-programming''' assignment (you may work with one partner if you wish).
Changed lines 22-25 from:
The input to the program will be the cat speed (e.g., 1, 5, or 10). This determines how many pixels the cat moves for each press of the arrow keys.

The output of the program should be graphical, using the [[http://www.cs.cofc.edu/~manaris/jythonmusic/?page_id=179 | gui library]], and
these images:
to:
The input to the program will be the cat speed (e.g., 1, 5, or 10). This determines how many pixels the cat moves for each press of the arrow keys.

Game goes on while mouse can evade cat.
Game ends when cat captures mouse (hint - use Widget @@encloses()@@ or @@intersects()@@ functions).

Score gets incremented for each pixel the mouse moves (pays to keep moving).

When game over, display a Game Over message.

The output of the program should be graphical, using the [[http://www.cs.cofc.edu/~manaris/jythonmusic/?page_id=179 | gui library]], and potentially
these images:
Changed lines 36-43 from:
Additional details on textual output will be provided shortly.

!!Bonus

After you finish the above
, feel free to create a separate program which has additional game features, e.g., scoring, rules, timing, [[http://www.cs.cofc.edu/~manaris/jythonmusic/?page_id=275 | sounds]], etc. Whatever you do, focus on making your game more fun to play.

Make sure your header documentation clearly describes the additional features you have added
.
to:
It is OK to use your own (other) images.

Consider adding [[http://www.cs.cofc.edu/~manaris/jythonmusic/?page_id=275 | sounds]], etc.

Whatever you do, focus on making your
game more fun to play.

Make sure your header documentation clearly describes all game features
.
Changed line 68 from:
# If you do the bonus, submit a separate, additional program. Give this program a different name, i.e., '''catAndMouseGame.bonus.py'''
to:
# '''Be ready to play (demonstrate) your game in class.'''
Changed line 2 from:
'''Due Date''': Friday, Mar. 20, 2015\\
to:
'''Due Date''': Monday, Mar. 23, 2015\\
Changed lines 40-44 from:
Your comments should reflect the "why" something is there (or being done), as opposed to the "how". The "how" is reflected in the code. The "why" usually comes from the thought you had, as to what you were trying to do, '''before''' you wrote the corresponding Python code. So, since that info is in your head first (i.e., before you write the code), it is much easier to type it in your program ('''before''' you figure out the corresponding code that does what needs to be done). Conversely, once you have already written the code, it is very hard to go back and recreate the original thought (thus comments written *after* the code tend to focus on the "how" something is being done, and not the "why" - the latte being what we need.)
to:
Your comments should reflect the "why" something is there (or being done), as opposed to the "how". The "how" is reflected in the code. The "why" usually comes from the thought you had, as to what you were trying to do, before you wrote the corresponding Python code.

So, since that info is in your head first (i.e., '''before''' you write the code), it is much easier to type it in your program ('''before''' you figure out the corresponding code that does what needs to be done).

Conversely, once you have already written the code, it is very hard to go back and recreate the original thought (thus comments written '''after''' the code tend to focus on the "how" something is being done, and not the "why" - the latter being what we need.)
Changed line 40 from:
Your comments should reflect the "why" something is there (or being done), as opposed to the "how". The "how" is reflected in the code. The "why" usually comes from the thought you had, as to what you were trying to do *before* you wrote the corresponding Python code. So, since that info is in your head first (i.e., before you write the code), it is much easier to type it in your program (*before* you figure out the corresponding code that does what needs to be done). Conversely, once you have already written the code, it is very hard to go back and recreate the original thought (thus comments written *after* the code tend to focus on the "how" something is being done, and not the "why" - the latte being what we need.)
to:
Your comments should reflect the "why" something is there (or being done), as opposed to the "how". The "how" is reflected in the code. The "why" usually comes from the thought you had, as to what you were trying to do, '''before''' you wrote the corresponding Python code. So, since that info is in your head first (i.e., before you write the code), it is much easier to type it in your program ('''before''' you figure out the corresponding code that does what needs to be done). Conversely, once you have already written the code, it is very hard to go back and recreate the original thought (thus comments written *after* the code tend to focus on the "how" something is being done, and not the "why" - the latte being what we need.)
Added lines 1-60:
'''Assigned Date''': Friday, Mar. 13, 2015\\
'''Due Date''': Friday, Mar. 20, 2015\\
'''Due Time''': 12:20pm

Last modified on {$LastModified} [-(see [[http://www.cs.cofc.edu/~manaris/index.php/Spring2015.CSCI220Homework3?action=diff&source=n&minor=n | updates]]) -]

!!Assignment

Write a program that simulates a game of cat and mouse. Your program should animate a picture of a cat using the arrow keys, and a picture of a mouse using (what else?) the mouse (or a touchpad).

The goal of the game is for the cat player to capture the mouse, and for the mouse player to evade capture.

!!Learning Objectives

* To learn the fundamentals of procedural analysis and design.
* To learn the features of procedural programming: the major types of statements, such as assignment, repetition, and the major data types, such as integers, real numbers, and character strings.

!!Input and Output

The input to the program will be the cat speed (e.g., 1, 5, or 10). This determines how many pixels the cat moves for each press of the arrow keys.

The output of the program should be graphical, using the [[http://www.cs.cofc.edu/~manaris/jythonmusic/?page_id=179 | gui library]], and these images:

http://www.cs.cofc.edu/~manaris/uploads/cat.png

http://www.cs.cofc.edu/~manaris/uploads/mouse.png

Additional details on textual output will be provided shortly.

!!Bonus

After you finish the above, feel free to create a separate program which has additional game features, e.g., scoring, rules, timing, [[http://www.cs.cofc.edu/~manaris/jythonmusic/?page_id=275 | sounds]], etc. Whatever you do, focus on making your game more fun to play.

Make sure your header documentation clearly describes the additional features you have added.

!!Documentation

In general, you should comment any variable, obscure statement, block of code, etc. you create.

Your comments should reflect the "why" something is there (or being done), as opposed to the "how". The "how" is reflected in the code. The "why" usually comes from the thought you had, as to what you were trying to do *before* you wrote the corresponding Python code. So, since that info is in your head first (i.e., before you write the code), it is much easier to type it in your program (*before* you figure out the corresponding code that does what needs to be done). Conversely, once you have already written the code, it is very hard to go back and recreate the original thought (thus comments written *after* the code tend to focus on the "how" something is being done, and not the "why" - the latte being what we need.)

The goal of comments is to gently introduce someone accurately into the big picture of our code - the forest view - while the code itself represents the tree view.

Additionally, your code should always have header documentation that explains what the program does, in general terms.

Follow the documentation instructions from [[Spring2015.CSCI220Homework1 | Homework 1]].

!!Submissions

You will submit your assignment via [[https://lms.cofc.edu/ | OAKS]]. Your submission consists of:

# Your Python program. Call it, '''catAndMouseGame.py'''. Include all necessary files (e.g., images, sounds, etc.)

# A printout of your program - to be submitted in class on the due date.

# If you do the bonus, submit a separate, additional program. Give this program a different name, i.e., '''catAndMouseGame.bonus.py'''

!!Grading

Your grade will be based on how well you followed the above instructions.