You’re on a hill in thick fog, trying to reach the bottom. You can’t see it; you can only feel the slope under your feet: how steeply the ground rises as you go right (negative means it rises to the left). Write step(position, slope, step_size): where your next step should land.
You stand at position 3 on a hill hidden in fog, trying to reach the bottom. All you can feel is the ground under your feet. Walk it yourself, then write the function that decides each step.
step(position, slope, step_size)| position | where you stand, a number on a line | e.g. 5 |
| slope | how steeply the ground rises to the right here | e.g. 0 |
| step_size | how bold your steps are | e.g. 0.1 |
| returns | where your next step should land | |