Car Self-Driving Interface
You need to re-implement the
controlCar function will be called several times per second during the chase to allow for course corrections.
controlCar function takes a single parameter –
which is an array containing 17 integers denoting distance from your car to the nearest obstacle:
- [indexes 0-7]: on the left side of the car (index 7 is the measurement at the left headlight),
- [index 8]: at the center of the car,
- [indexes 9-16]: on the right side of the car (index 9 is the measurement at the right headlight).
See also this image (it's not precise, but will give you an idea what you are looking at).
All measurements are parallel to each other.
A negative measurement might appear if the obstacle is very close behind our car.
controlCar must return an integer denoting where the car should drive:
- -1 (or any other negative value): drive more to the left,
- 0: continue straight / straighten up the car,
- 1 (or any other positive value): drive more to the right.