elevator.on("idle", function() { elevator.goToFloor(0); });
February 6, 2015 11:27 AM   Subscribe

Elevator Saga is a game in which you write Javascript to control a bank of elevators.

Read the documentation and check out the Wiki for solutions.
posted by alby (23 comments total) 52 users marked this as a favorite
 
If they all go to the basement and refuse to come out . . .
posted by Standeck at 11:41 AM on February 6, 2015 [2 favorites]


There goes my Friday. At least it looks like I'm working.
posted by Hamusutaa at 11:47 AM on February 6, 2015 [4 favorites]


Events is missing:

Fire Alarm
Sex in the Elevator
Giving Birth in the Elevator
Tremors
Lights Flicker
Tornado Siren
Tsunami Siren
Angry Stalker
Random Angry Pigeon
Skip every $RandomNum floor request


Elevator Objects are missing:

Panic Button (and associated Events)
Light Flicker Control
Grinding Noise Maker
Cabin Shaker
Fart Dispenser


But maybe I just want to torture non-RIFfed office drones too much this week.
posted by Buttons Bellbottom at 11:52 AM on February 6, 2015 [5 favorites]


I totally cracked out on this game for an entire morning last weekend. Gave up eventually because the UI presents state that isn't really exposed in the UI. Event-driven programming is great for web and async, but real-world elevators use PLC or similar logic controllers. Having to write a state machine to track things like "is the second-floor up button currently depressed" while it's being displayed by the game got pretty annoying.
posted by 7segment at 11:52 AM on February 6, 2015 [2 favorites]


Javascript infuriates me, and I'm dreadful at object oriented and event-based stuff. So I'm planning on hate-programming this all day.
posted by Jimbob at 11:56 AM on February 6, 2015 [8 favorites]


I had a rommate who was a mechatronics engineering student when I was an undergrad, and one of his assignments was to control a bank of elevators using Javascript. Coincidence?
posted by Dr. Send at 11:58 AM on February 6, 2015


Someone smarter than me should build a spiritual sequel with two-player options to make the OTV hacking scene in Hackers a competitive command line game.
posted by filthy light thief at 12:02 PM on February 6, 2015 [1 favorite]


Well I guess this is practice for that interview question...
posted by Artw at 12:30 PM on February 6, 2015 [1 favorite]


man this is so much like the puzzle i would love to grind up my brain on!

but i just don't know what's capable with the coding, you know? hhhh.
posted by rebent at 12:33 PM on February 6, 2015


This really makes me long for Quadrilateral Cowboy, which includes command-line hacking as an essential part of the game. (At least in the small demo I was able to play of it...)
posted by fifteen schnitzengruben is my limit at 12:38 PM on February 6, 2015 [1 favorite]


Great concept. Something halfway between this and Railroad Tycoon...
posted by Segundus at 1:12 PM on February 6, 2015


I have some pretty BASIC coding experience. Is this something I could play after finishing the Javascript module on Codecademy?
posted by benbenson at 2:05 PM on February 6, 2015


JavaScript is an ugly sumbitch.
posted by GallonOfAlan at 2:19 PM on February 6, 2015 [2 favorites]


Not as much fun as SimTower.
posted by charlie don't surf at 3:30 PM on February 6, 2015 [2 favorites]


Is this something I'd need to have a computer to understand?

My javascript is pretty rusty but I still find this interesting. With a little bit more handholding, it would be a great intro to programming tutorial.
posted by thewumpusisdead at 3:41 PM on February 6, 2015


I have some pretty BASIC coding experience. Is this something I could play after finishing the Javascript module on Codecademy?

Or less. Really all you need is to read their docs on the available functions, maybe look up what loops and if statements look like in JS, maybe how variables/arrays are stored and that's probably all you'd need. Then again, there isn't a whole lot more to the absolute basics of javascript anyway.
posted by RustyBrooks at 4:07 PM on February 6, 2015


Having to write a state machine to track things like "is the second-floor up button currently depressed" while it's being displayed by the game got pretty annoying.

I did that as well, until I realized it was available in the undocumented floors[level].buttonStates[direction]
posted by Phssthpok at 4:11 PM on February 6, 2015 [1 favorite]


When you tire of this, try The Schemaverse: a space-based strategy game implemented entirely within a PostgreSQL database. Compete against other players using raw SQL commands to command your fleet.
posted by zengargoyle at 6:09 PM on February 6, 2015 [6 favorites]


Protip: If you're going to loop over the elevators and floors, make sure to define any functions you mean to use before the start of the loop. Javascript will let you define new functions all kinds of places, but the variables those functions use won't work like you'd expect if you're coming from, say, Python.
posted by LogicalDash at 2:36 AM on February 7, 2015


I seem to recall from school that it's quite challenging to get a better algorithm than "nearest called floor first". As in, exponentially (real exponentially, not figuratively) more difficult to be worth the extra processing cycles.

Unless you can change the way call buttons work, like some offices, with their "tell me which floor you want, I'll tell you which elevator to catch" system, and there are no buttons inside the actual elevator car.

Which really weirds people out when they've never seen them before.

Software is hard, man.
posted by But tomorrow is another day... at 4:00 AM on February 7, 2015


This game has just reminded me of why I hate JavaScript. I'm sure that the problem is something akin to what LogicDash describes, but almost not a single element is behaving anywhere near how I would expect them to.
posted by vernondalhart at 1:24 PM on February 8, 2015


Easier still:
Don't use explicit loops. Use array.forEach and array.map.
posted by yonega at 2:31 PM on February 8, 2015


Protip: If you're going to loop over the elevators and floors, make sure to define any functions you mean to use before the start of the loop. Javascript will let you define new functions all kinds of places, but the variables those functions use won't work like you'd expect if you're coming from, say, Python.

In the sense that the functions close over the index var? That's an issue in Python, too:
>>> fns = []
>>> for i in range(5):
...    def f():
...        return i
...    fns.append(f)
...
>>> [f() for f in fns]
[4, 4, 4, 4, 4]
posted by invitapriore at 3:55 PM on February 8, 2015


« Older 1969 was a year giants rocked the earth, and they...   |   Drone Takeoffs Limited by No-Fly Software Newer »


This thread has been archived and is closed to new comments