Elevator Saga Unblocked

Program a building's elevators in JavaScript and keep refining your code until every rider gets where they are going on time.

Elevator Saga is a programming game where you never press a button in the elevator yourself. Your job is to write a small piece of JavaScript that decides where each car goes. Then you watch tiny riders show up, press call buttons, climb aboard and step off, all according to your logic.

Each challenge has a goal, such as delivering a certain head count before the clock runs out. Sloppy logic strands passengers, so you keep improving it until the building runs smoothly.

The setup

The top of the screen shows the building. Below it is an editor that numbers each line, colors your syntax and closes brackets for you. It opens with a starter program that works, but not well.

Your code has to be an object with two functions. The init function runs once when a challenge begins. The update function runs over and over as time passes. The bulk of your logic belongs in init, where you attach event listeners to the elevators and floors.

Rules in brief

Elevators can listen for events like idle, floor_button_pressed and stopped_at_floor. Floors report up_button_pressed and down_button_pressed. Inside those handlers you might send a car somewhere with goToFloor(), read loadFactor() to judge how crowded it is, or rearrange the destinationQueue.

Challenges measure success in different ways. Some count seconds, some limit the total distance your cars cover, and some fail you if any rider waits too long. A built-in Help page lists every function and event with examples you can copy.

Good first upgrades

  • The starter code only goes between floors 0 and 1, so anyone on the top floor is left behind. Listen for floor_button_pressed and send the car where its passengers asked to go.
  • Use the hall call events so idle cars head to floors where people are waiting.
  • Check loadFactor() before stopping for a pickup. A packed car cannot take anyone else.
  • On move-limit challenges, wait to collect several riders instead of rushing up and down.

Testing your ideas

A time scale control runs the simulation anywhere from 1x up to 55x. Crank it up to see quickly whether a plan holds, then drop back to normal pace to find the moment things go wrong. Live stats show how many people you have moved, riders per second, average and longest wait, and total moves.

When you clear a challenge, a Next challenge button takes you on. Save, Reset and Undo reset buttons let you keep good code safe while you experiment.

Controls

ActionKeyboardMouse
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"

Elevator Saga FAQ

Can I play Elevator Saga on a Chromebook?

Yes, a Chromebook with a keyboard works well, since the game is built around typing code. Phones and tablets are not a good match, because the wide desktop layout and the code editor need a real keyboard and a bigger screen.

How many challenges are there?

There are 18 graded challenges, each with its own goal. They begin with one elevator and a few floors and grow to several cars of different sizes in buildings up to 21 floors tall. After those comes a bonus stage that simply runs forever without a target.

What should I do if my elevators stop moving?

Look above the editor for a red message. It shows up if the code will not parse, or if either of the two required functions, init and update, is absent. Fix the problem, then click Apply, because new code only runs after Apply or a restart.

Is my code kept between visits?

Yes. Your program is written to browser storage roughly one second after you pause typing, and pressing Save stores it immediately. The speed setting is remembered too. Clearing browser data removes the saved code.

More games like Elevator Saga

All puzzle games →