Bounce!!

Here’s the skeleton of the bounce program. Copy and paste into a new program.

from visual import *

floor = box (pos=vector(0,0,0), length=4, height=0.1, width=4, color=color.blue)
ball = sphere (pos=vector(0,10,0), radius=2, color=color.magenta)
ball.velocity = vector(0,0,0)
dt = 0.01

#the 1 after the while is interpreted as "true" when this program runs,
#basically turning this into an infinite loop.
#The loop is obviously incomplete, but think about what you would need to add
#to make this ball "bounce." It should accelerate at 9.81. You will need to
#include an if/else argument.
while 1:
 rate (100)
 ball.pos = ball.pos + ball.velocity*dt