Collision Detection
@BootstrapWorld
#BootstrapCS
Problem Decomposition Returns!
@BootstrapWorld
#BootstrapCS
Problem Decomposition Returns!
You may remember that there are two strategies for doing this:
Top-Down: Describe the problem at a high level, then fill in the details later.
Bottom-Up: Focus on the smaller parts that you’re sure of, then build them together to get the big picture.
@BootstrapWorld
#BootstrapCS
Problem Decomposition Returns!
A retractable pole starts out 24 inches tall, and grows at a rate of 0.6in/sec. An elastic is tied to the top of the pole and anchored 200 inches from the base, forming a right triangle. Define functions that compute the height of the pole and the area of the triangle after a given number of seconds.
Turn to Top Down, Bottom Up (Page 57) in your student workbook, and solve this word problem using any order you like!
@BootstrapWorld
#BootstrapCS
Problem Decomposition Returns!
Which strategy did you use? Top-Down or Bottom-Up?
Did you start out with one, and then switch to another?
Which was easier for you?
@BootstrapWorld
#BootstrapCS
Collision Detection
We already have a function that will tell us how close together two points are. What is that function called?
Knowing how far apart our characters are is only the first step! We still need the computer to be asking: "Are they close enough to collide?"
@BootstrapWorld
#BootstrapCS
Collision Detection
@BootstrapWorld
#BootstrapCS
Collision Detection
You started by writing the distance function first, and then collide? Is this Top-Down or Bottom-Up decomposition?
collide? function was easy to write, because we could re-use the distance function.
Have we done anything like this before?
@BootstrapWorld
#BootstrapCS