Your file must define class MyTower extends Tower. The simulation calls
your methods; you answer by calling methods on the airplanes. One tick is one simulated second.
Methods you implement
onStart(world)
Once, before the first airplane appears.
onArrival(plane, world)
An arrival has entered the airspace.
onDepartureReady(plane, world)
A departure is ready at the gate.
onTick(world)
Every simulated second.
onConflict(a, b, world)
Two airplanes have just collided. For debugging.
Commands
plane.clearToLand()
Arrival may continue past FINAL and land.
plane.clearForTakeoff()
Departure enters the runway and goes.
plane.hold()
Circle at the present position. One circle takes 60 seconds.
plane.resume()
Stop circling, drop any detour, and carry on along the route.
plane.flyTo(x, y)
Detour to a point, then rejoin the route by itself. Also takes a point,
for example plane.flyTo(world.fixes.BASEN). Calling it again replaces the detour.
Works in the air, before the FINAL fix is passed.
plane.setSpeed(knots)
160 to 250. The default is 220. Faster burns more fuel.
Position in nautical miles. (0, 0) is the top left; the map is 48 by 32.
plane.heading
Compass degrees. 0 is north (up), 90 is east.
plane.speed
Knots.
plane.eta
Arrivals: seconds until touchdown at the present speed, with no holding.
plane.distanceToRunway
Arrivals: miles left to fly along the route.
plane.distanceTo(other)
Miles to another airplane, or to anything with x and y.
plane.entry, plane.exit
Name of the fix the airplane came from or is going to.
plane.target
The next point it is flying to, with x and y.
plane.vector
The detour point set by flyTo, or null.
eta and distanceToRunway include the detour.
plane.cleared
True once it has been cleared to land or take off.
plane.waited
Seconds spent at the gate or circling so far.
The airplane objects stay the same from tick to tick, so you can keep them in arrays
and attach your own properties to them.
Reading the world
world.time
Seconds since the start.
world.planes
Every airplane now in the system.
world.arrivals
Just the arrivals.
world.departures
Just the departures.
world.waiting
Departures at the gate that are not yet cleared, oldest first.
world.runway.isClear
True when nobody is on the runway.
world.runway.occupiedBy
The airplane on the runway, or null.
world.runway.threshold, .end
Where landings touch down and where takeoffs lift off.
world.fixes
Named points, for example world.fixes.POLAR.
world.finalFix
The FINAL fix, 7 miles west of the runway.
world.separation
3. Closer than this in the air is a collision.
world.find(id)
Look up an airplane by callsign.
Rules
A takeoff occupies the runway for 40 seconds, a landing for 45.
Two airplanes on the runway at once is a collision.
Two airplanes in the air less than 3 miles apart is a collision.
Debugging
console.log(a, b, ...)
Prints to the Console. Objects, airplanes and arrays appear
with a small arrow: click it to open them. What you see is a copy taken at that moment.
console.table(list)
Prints a list as a table, one row per item.
console.table(list, ["id", "eta"])
The same, with only the columns you name.
In the editor, suggestions appear as you type after a dot. Press Ctrl+Space to ask for them anywhere.
Cmd+/ (or Ctrl+/) comments the selected lines out, or back in. A syntax error is marked on its line.
Scoring (lower is better)
1 point per second of delay, measured against the time each flight would take with the sky to itself