easyFind the maximum, every turn
Ridge Breaker
A cargo drone is coming down over a ridge of eight mountains and it cannot climb. Every turn it drops one level.
You control its mining laser. Each turn you blast one mountain flat. If any mountain is still as high as the drone after your shot, it hits it.
Input: state
- heights
- array of 8 numbers, left to right. 0 means already flat.
- altitude
- the drone's altitude this turn, in the same units.
ReturnThe index (0 to 7) of the mountain to blast.