CS 010 - Introduction to Computer Science I
Assignment 6:

DUE: Mon, November 22 before 5:00pm


Collaboration Policy

Collaboration is strongly ENCOURAGED. You will be working in teams, but programs must represent YOUR OWN original work. Teams should work on the algorithm together and help debug/test each others code. However, copying code from ANY source (any book, current or past students, past solutions, the web, etc.) is STRICTLY FORBIDDEN. Code between teamates will be similar, but you are not allowed to just copy a teamate's solution.


Code that is turned in, must be contained in a .cpp file named main.cpp. Files of any other format will not be graded (e.g. main.doc, main.txt, etc…).

You must turn your work in from a lab computer on campus.

Turn in online to as6-(group letter) folder. If you turn your assignment in to the wrong folder, your assignment may not be graded. If it is graded, you will lose 2 pts (out of 10).

Remember to include the following header information at the top of your program;

// Course: CS 10
//
// Lecture Section: ... 001 or 002
// Lab Section: ... 021, 022, etc)
//
// Assignment #: ... assignment 2, 3, etc.
//
// Last Name: Enter your LAST (family) name here (eg, Doe)
// First Name: Enter your FIRST (given) name here (eg, John)
//
// ID Number: Enter your ID number here (eg, 860-00-0000)
// lab login id: Enter your cs10 login here (eg, jdoe)
//
// Email address: Enter your UCR email address here (eg, jdoe@cs.ucr.edu)
//
// Group: Enter your group here (eg, D4)
// Teammates: List the names of the teammates you worked with
// Meeting Time: Specify the next time your team plans to meet
//
// =======================================================================


Problem Definition:

    For this assignment you will add code to, and modify your work from programing assignment 5.  You will add a function that will draw your ship instead of a circle, and modify your set acceleration function to allow the user to move the ship left, and right.  You do not need to worry about collision with the window's edge.
    You will have to add variables to ccc_win_main for the x position, velocity, and acceleration, and you should change the constant CURRENT_X to a variable.  You will also want to delete the constant for the circle's radius.
   
You will have to modify your set_acceleration function so that now it takes two reference parameters (which will be the x, and y acceleration as doubles), and returns void. Now the user will be asked to set the main, right, and left thruster.  Unlike the last assignment, now the user can choose Medium in addition to Hi, Low, or None.  For the y acceleration, High should be equal to 1, Medium 0.5, Low to 0, and None to -1.  Setting the right thruster to High should be equivalent to an acceleration of -1, Medium -0.5, Low -0.2, and None 0.  Setting the left thruster to High should be equivalent to an acceleration of +1, Medium +0.5, Low +0.2, and None 0.  If a selection is made for both the right AND left thruster, the resulting thrust should just be the sum of the two selections.  For example if the user selects High acceleration for both the left, and the right thruster, this would equal a net x acceleration of zero.
   
Movement to the left and right will be according to the same equations used in assignment 5.  You will use the same functions that you wrote for assignment 5 to set the x position and velocity.

Solution to Assignment 5
main.cpp

*Example Program Download
main

*note that your main may behaive differently in terms of speed of animation, depending on the speed of the computer you are using.

Rubric: (10 pts total)

1 pt: Has only ONE set velocity function, called for setting x or y
1 pt: Has only ONE set position function, called for setting x or y
1 pt: Set acceleration function is correctly passed two reference variables
1 pt: Acceleration function correctly sets y acceleration
1 pt: Acceleration function correctly sets x acceleration
2 pt: Ship is given correct (x,y) Point/position value for each iteration of animation loop
1 pt: Draws a ship using draw_ship function, and ship is big enough to see

2 pts: Style
- Good variable names
- Proper indentation and spacing
- Good comments
- No line wraps
- No magic numbers