A ball rolls down the foggy hill from “Walk downhill”. Unlike the careful walker, it carries some of its motion from one step to the next. Write roll(state, slope, step_size, keep): the ball’s new state. state is [position, velocity], where the velocity is how far the ball moved on its last step (negative means to the left). Each step the slope pushes the ball downhill, and keep (0 to 1) is how much of its motion the ball keeps.
| position | velocity |
|---|---|
| 3 | −0.4 |