# Birds solution

Overview Homework 7, worth 100 points towards your homework grade, is due by 11:59:59 pm on Thursday, November 6, 2014. All submission rules, academic integrity rules, and late penalties apply. Please pay careful attention to the submission instructions at the end of this document. Computer games such as Angry Birds are based on simulating the basic rules of physics, or at least some rough approximation to these rules. These simulations involve a simple basic loop where in each iteration 1. The positions and sometimes the velocities (however, not in this homework) of moving objects are both updated by a small amount. 2. Objects are checked for collisions, and changes are made to the simulation based on these collisions. While never 100% accurate, realistic looking results and physically useful predictions (for scientiﬁc simulations) can be obtained by making sure the changes in each loop iteration are small. We will apply this idea to a simple version of angry birds called CS 1 Birds. Along the way you will get practice writing and using classes. Read this whole homework ﬁrst before starting to write code. The simulation occurs over a rectangular region whose corners are locations (0,0) and (1000,1000). The simulation will include birds and pigs and both will be represented by circles. The pigs are stationary, but the birds will move along a line (no gravity!). Each bird will move in turn, slowing down when it strikes a pig, and stopping when it becomes 1.) too slow or 2.) when it goes outside the game rectangle. When a bird strikes a pig, the pig will “pop” and disappear from the simulation. The simulation ends when either all pigs have been “popped” or when all birds have stopped, whichever occurs ﬁrst.