问题要求:
Steer helicopter (“Fort Apocalypse”)
Program the controls of the helicopter for a simple version of the classic computer game “Fort Apocalypse” from 1982.
(If you want to see how it looked back then, here is a Fort Apocalypse online version)
The functions setup () and loop () must be programmed for this (see also the information on the simulation mode in the help)
The following functions for controlling and querying values are also available:
Preferences
slowMotion (f) – slow down the process by factor f (can only be called in setup ().)
showVectors () – Show the helicopter’s speed vectors (can only be called in setup ().)
showLaser () – Displays the laser to calculate the distance to the wall ahead (can only be called in setup ().)
showLines () – Show guides in the cave (can only be called in setup ().)
readings
getDistanceFront () – returns distance to the wall to the front
getDistanceTop () – returns distance to the ceiling
getDistanceBottom () – returns distance to the ground
getSpeedHorizontal () – returns the current speed in the X direction
getSpeedVertical () – returns the current speed in the Y direction
control
Up () – accelerates the helicopter up a bit (per call, can also be called several times!)
Down () – accelerates the helicopter down a bit (per call, can also be called several times!)
Faster () – accelerates the helicopter
Slower () – brakes the helicopter
The task is considered complete when the helicopter comes through the cave without a crash (2,500m).