Lab Assignment 4b -- Demo and writeup due Thursday, April 27
CS 5721, Spring Semester, 2006
25 Points
Topic: An Interactive Game
The assignment:
is to convert the program of Lab 4 into an interactive game.
For this lab, the user will control the robot (mostly) by using the mouse.
The object of the game is
to interactively pick up the rod. Start the robot in its initial position
in the robot_anim program.
- Control the robot as follows:
-
Clicking the right or left mouse button makes the robot turn 90 degrees right
or left respectively.
-
Clicking the center mouse button moves the robot forward 5 units.
-
Pressing the "g" (for grab) key down lowers the robot arm; pressing the "r"
key raises the arm. If the robot is in the right position (test for this) to
grab the rod and the robot arm has been lowered, have the robot grab
the rod; if the robot is not in the right position, issue a "beep"
(I think
SPH_beep() will do it).
If the robot has grabbed the rod and
the "r" key has been pressed, write "You won!" on the SPHIGS window
(hint: see
#define WriteMessage(s) in
robot_anim.c).
(If you can't get
SPH_beep()
to work on the PC's in MWAH 177, you can just write "Beep" to standard output.)
Note: this lab requires querying the event queue for both locator and keyboard
events.
-
Finally, put a "face" on the body of the robot: two eyes, a nose, and
a mouth (red?) on the front, and an ear on either side.
Extra credit:
- (1 point) Create some low walls (low ==> you can see over them; thin
rectangular polyhedra are fine) as
barriers that the robot must maneuver around to get to the rod.
- (1 point) Make the robot press (by running into it or by lowering its
arm) a "release button" (a small red
rectangular polyhdron) on one of the walls,
which must be done before it can pick up the rod. As with picking up
the rod, test for being in the right position. Also issue a "beep" when
the butten has been pressed successfully.
- (2 points) If the robot tries to move through a wall or out the front
of the room, don't let it do that and also issue a "beep". This is
called collision avoidance.
- (3 points) Show the view from "over the robot's shoulder": that is,
the viewing-reference coordinate (VRC) system moves with the robot --
COP will be slightly above and behind the robot. You may want to
initially "zoom in" a bit closer to the robot.
- (1 point) Have the robot jump up and down three times after it has won.
What to turn in or demo:
Since this lab has visual aspects that can most easily be observed and
explained in a live demo,
you should do a demonstration of your program for the TA.
Turn in or do the following items from the
Computer Science Lab Report Format:
1. (1 point) The Basic Information (your name, class, section,
TA's name, assignment number, and date) can be on a separate cover sheet or as
(highlighted) comments at the top of your main program file.
2. (1 point) The Problem Statement is a brief description of
The assignment: above. Note: the problem statement can (and should)
be in a comment at the top of your main program file.
9. (If done.)
11. (11 points) Include the Program Listing(s).
These listings should show good style,
be appropriately commented, be sure to highlight the parts you have changed
from Lab 4,
and include handwritten explanations if it helps the
reader's understanding of the code.
13. & 14. (12 points) Do a "demo"
of your program. Also, do a demo of any extra credit items.
15. Include a description of any Known Bugs if needed.
You may be able to gain back lost points by a careful analysis of
what went wrong and possible fixes.
16. This is optional (and no points usually),
but it is useful to think about Possible Improvements.
17. Comments on the lab assignment are also optional
(and again, no points usually), but appreciated!
Important Note:
You may discuss algorithms with other students, but the program and
lab report should be your own work.
Page URL: http://www.d.umn.edu
/~ddunham/cs5721s06/assignments/lab4b/assignment.html
Page Author: Doug Dunham
Last Modified: Tuesday, 18-Apr-2006 17:56:43 CDT
Comments to: ddunham@d.umn.edu