Assignment total points = Design (20 points) + Runs test cases (20 points) + Implementation Phase I (40 points) + Implementation Phase II (30 points) + Style and documentation (15 points) = 125 points
Educational Goals: The goals of this program are that the student should use the concepts of
You are going to write a program that will play a (simplified) game of Angry Birds. The red bird is flung across the screen to try to hit the green pig on the other side. The pig is either hit or he is not. You get a point for every pig that you hit.
This program will be done in TWO stages. Design and implementation will be done with console (Shell) output first. Then the graphics elements will be added.
You will need these formulas:
It is assumed that the pig is "near" the right side of the screen. It does not stay in the same place all the time; in fact, it moves a random (but small) amount for every round. Note how the distance to the pig changes with every round in the runs below.
Sample Run WITHOUT the graphics:
Angry Birds! Bird is at left edge of screen. Pig is at right edge of screen. Enter angle and velocity to catapult the bird to make it land on the pig How many rounds do you want to play? 3 Level of difficulty? (smaller is harder) 10 Round # 1 The pig is 124 meters away What angle? 45 Initial velocity? 40 The bird flew 163 meters and reached a height of 41 meters you missed Round # 2 The pig is 149 meters away What angle? 45 Initial velocity? 35 The bird flew 125 meters and reached a height of 31 meters you missed Round # 3 The pig is 100 meters away What angle? 45 Initial velocity? 37 The bird flew 140 meters and reached a height of 35 meters you missed You got NO pigs!
Angry Birds! Bird is at left edge of screen. Pig is at right edge of screen. Enter velocity and angle to catapult the bird to make it land on the pig How many rounds do you want to play? 3 Level of difficulty? (smaller is harder) 40 Round # 1 The pig is 124 meters away What angle? 35 Initial velocity? 40 The bird flew 153 meters and reached a height of 27 meters you got the pig! Round # 2 The pig is 149 meters away What angle? 45 Initial velocity? 35 The bird flew 125 meters and reached a height of 31 meters you got the pig! Round # 3 The pig is 100 meters away What angle? 45 Initial velocity? 25 The bird flew 64 meters and reached a height of 16 meters you got the pig! you got the pig 3 times
Link to the tables of test cases.
Decide on what steps you will need to perform to solve this problem.
Put it in Python form as comments. Save this Python file as "design2.py".
See this page about
how to write control structures in a design.
You are expected to use a loop and an if/else statement.
Note that you should NOT consider the graphics part of the problem
when you are doing the individual design.
There are some specifications that your design and program MUST meet.
Implement the design with SHELL output (Text), NOT graphics
Write a Python program to implement your design. You may have the help of ONE student,
as well as of Dr. Keen and ALL the TAs.
Start with a copy of the Python file you have that has the design in it
and write your Python code between the commented lines of the design.
Make sure you eliminate any syntax and semantics errors.
Verify that the program provides the correct behavior.
Now that you have your logic working correctly. implement the program again as a graphics program. Use the gifs at the top of the assignment page or get others, if you like. They must be called bird.gif and pig.gif. Submit this program by Sunday, November 5, midnight, using the link above.
The description of the graphics part is here.
If you want more to read about projectiles and their behavior, Wikipedia page about projectiles in motion is a good start.
Please read the documentation standard on the class web page. As you can see from looking at the grading page, we will be looking to see how you meet these standards. Note particularly that we require a header comment!