This is an old revision of the document!


Angry Birds

Activity Information

Learning Goals

Prior Knowledge Required

Code Manipulation

—-

Activity

Handout

Angry Birds You have set up your Angry Bird catapult 250 m away from a pig encampment in order to destroy them. The encampment is here on Earth. You are to ignore the effects of air friction in your calculations and computer simulation.

Pre-Coding Questions
  1. Select an initial velocity for your Angry Bird in order to obliterate the encapment. Using this velocity, determine the angle of elevation required to hit the pig encampment, thus destroying those scoundrels!
  2. Now determine the horizontal and vertical components of the velocity based on your calculated angle.
  3. Now imagine that you locate another pig encampment that is directly above the one you have destroyed. If it's 52 m directly above the first encampment, determine the necessary velocity and angle of elevation to hit and destroy this one.
Post-Coding Questions
  1. Using the minimally working code (below), modify it such that it fits the initial scenario.
  2. Adjust this code so that it fits the second scenario

Code

  1. floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white)
  2. crate1 = box(pos=vector(-145,7,0), size=vector(10,10,3), color=color.blue)
  3. crate2 = box(pos=vector(140,10,0), size=vector(20,20,5), color=color.red)
  4.  
  5. #Setting the time interval
  6. t=0
  7. dt=0.01
  8.  
  9. crate1v=vector(25,5,0)
  10. while crate2.pos.x-crate1.pos.x>20:
  11. rate(50)
  12. crate1.pos=crate1.pos+crate1v*dt
  13. t=t+dt

Answer Key

Handout

Pre-Coding Solutions
  1. In order to approach this problem, we can start by trying to solve the following system of equations that describes simple projectile motion: $$x=x_0+v_x*t$$ $$y=y_0+v_y*t+\dfrac{1}{2}g*t^2$$ where $x$ and $y$ are the horizontal and vertical positions of the bird, $v_x$ and $v_y$ are the horizontal and vertical components of the bird's velocity, $t$ is time, and $g$ is the acceleration due to gravity (9.8 m/s/s). Assuming the initial position is at the origin, we know the final location ($x=250$ and $y=0$). As well, based on this Wired article, the magnitude of the velocity of a sling-shot angry bird is about 22 m/s. We don't, however, know the horizontal or vertical components of this velocity, so we will have to make a substitution. Using trigonometry, we find that $v_x=22\cos(\theta)$ and $v_y=22\sin(\theta)$

Code

  1.  

See Also

  • repository/angry_birds.1611165889.txt.gz
  • Last modified: 2021/01/20 18:04
  • by porcaro1