GN Math

Elevator Saga Unblocked

Control a tower's lifts with your own JavaScript and pass 18 timed transport challenges.

psst: bring a keyboard for this one

now playing: Elevator Saga

Ever stood in a lobby wondering why the elevator took so long? Here you get to fix it yourself. Elevator Saga unblocked hands you a building full of impatient riders and a code editor, and the cars only move the way your JavaScript tells them to.

It is a real programming puzzle by Magnus Wolffelt and contributors. You write event handlers, watch the simulation play out, and keep refining your logic until the riders get where they are going in time.

How to play Elevator Saga

The building sits at the top of the page and the code editor below it. Your program is an object with an init function, which runs once at the start, and an update function, which is called over and over as time passes.

In init you attach listeners to each elevator and floor. Elevators report events like being idle, a floor button being pressed or stopping at a floor. Floors report up and down calls. Inside those handlers you send cars to floors, check how full they are, or rearrange their queue of stops. Click Apply to run your code.

There are 18 graded challenges. They start with one car and a few floors and grow to many cars and tall buildings. Some goals count time, some limit how far cars may travel, and some end in failure when a rider is left waiting past a limit.

Controls

To…KeyboardMouse
Type and edit your elevator programType in the code editor (Tab inserts four spaces)Click inside the editor to place the cursor
Run your code from the start of the challenge—Click "Apply"
Start, pause or restart the simulation—Click the Start / Pause / Restart button
Change simulation speed—Click the minus or plus icon next to the speed number
Go to the next challenge after a win—Click "Next challenge"
Save, reset, or bring back code from before a reset—Click "Save", "Reset" or "Undo reset"

Tips

  • Read the Help page first. It documents what cars and floors can do, with sample snippets, which saves a lot of guessing.
  • Answer floor calls, not just buttons inside. Many early failures come from cars that only serve riders already aboard.
  • Skip stops when full. Checking how loaded a car is before stopping for a hall call keeps full cars from wasting trips.
  • Slow the sim to debug. Use the speed controls to watch what each car does step by step, then speed up once it behaves.
  • Keep a working copy. Before a big rewrite, copy your passing code somewhere safe. Undo reset only brings back code from before a reset.

Elevator Saga questions

Does my code save when I leave?

Yes. Your program is kept in browser storage a moment after each edit, and clicking Save writes it there at once.

My elevators stopped moving. What went wrong?

Most often there is a typo in the code, or one of the two required functions is gone. Look for an error shown in red near the top of the editor, fix it, then click Apply.

Can I play Elevator Saga on a phone?

Not really. You spend most of your time typing code on a wide layout, so a laptop, desktop or Chromebook with a keyboard is the way to go.

Homework: games like Elevator Saga

all coding games