Live data from Hacker News

Elevator Saga – An elevator programming game

play.elevatorsaga.com

51–60 of 108 posts

Re: Elevator Saga – An elevator programming game

#51

This is brilliant. Do you know of other games like this?

http://www.pythonchallenge.com/ - Gamified way to learn Python, but is a puzzle in addition to being a game. Is not exclusive to Python, but many things are intended to be solved with things that are idiomatic in Python.

www.checkio.org - Looks more like a game, but the programming environment feels more "in-your-face" than elevator saga to me.

Re: Elevator Saga – An elevator programming game

#53
post #41

My attempt at a basic smart algorithm. Not so easy... https://gist.github.com/kballenegger/e275a99d50de2ee07f97

here mine: https://gist.github.com/eridal/7ce55190837801811067

side note: why are you using underscore? I wanted to try your code, but doesn't work out-of-the-box.

Re: Elevator Saga – An elevator programming game

#54
post #41

My attempt at a basic smart algorithm. Not so easy... https://gist.github.com/kballenegger/e275a99d50de2ee07f97

Why do you have conditionals written like this: if (elevator.goingUpIndicator() == true)? Why not just: if (elevator.goingUpIndicator())?

I believe some people really need think in term of comparations and, for those, adding a "==" symbol make sense, even if the resultant code doesn't make any sense at all!!

Also, I can never understand why people write ..

    if (foo()) {
        return true;
    } else {
        return false;
    }
.. or things like extra parens on conditionals, or weird styles like:

    return (false);

I strongly believe people write as they talk, and talk as they think; which not clearly translates linearly when what you write is code ;)

Re: Elevator Saga – An elevator programming game

#55
post #54

Earlier quoted context omitted.

Why do you have conditionals written like this: if (elevator.goingUpIndicator() == true)? Why not just: if (elevator.goingUpIndicator())?

I believe some people really need think in term of comparations and, for those, adding a "==" symbol make sense, even if the resultant code doesn't make any sense at all!! Also, I can never understand why people write .. if (foo()) { return true; } else { return false; } .. or things like extra parens on conditionals, or weird styles like: return (false); I strongly believe people write as they talk, and talk as they…

Many languages are expressions (as opposed to statements) including C-like languages. I've always thought that 'return' itself was redundant. If a compound statement was defined to return the value of the final (executed) statement, then functional methods would get much simpler. And remove the need for the '?' operator for instance.

e.g.

   int foo(int x) {   bar(x,y); }
or

   x = {if (foo() > 9) true; else false; }

Re: Elevator Saga – An elevator programming game

#57
post #54

Earlier quoted context omitted.

I believe some people really need think in term of comparations and, for those, adding a "==" symbol make sense, even if the resultant code doesn't make any sense at all!! Also, I can never understand why people write .. if (foo()) { return true; } else { return false; } .. or things like extra parens on conditionals, or weird styles like: return (false); I strongly believe people write as they talk, and talk as they…

Many languages are expressions (as opposed to statements) including C-like languages. I've always thought that 'return' itself was redundant. If a compound statement was defined to return the value of the final (executed) statement, then functional methods would get much simpler. And remove the need for the '?' operator for instance. e.g. int foo(int x) { bar(x,y); } or x = {if (foo() > 9) true; else false; }

You might like functional languages.

Re: Elevator Saga – An elevator programming game

#58
post #54

Earlier quoted context omitted.

I believe some people really need think in term of comparations and, for those, adding a "==" symbol make sense, even if the resultant code doesn't make any sense at all!! Also, I can never understand why people write .. if (foo()) { return true; } else { return false; } .. or things like extra parens on conditionals, or weird styles like: return (false); I strongly believe people write as they talk, and talk as they…

Many languages are expressions (as opposed to statements) including C-like languages. I've always thought that 'return' itself was redundant. If a compound statement was defined to return the value of the final (executed) statement, then functional methods would get much simpler. And remove the need for the '?' operator for instance. e.g. int foo(int x) { bar(x,y); } or x = {if (foo() > 9) true; else false; }

Have you tried coffeescript? Your examples are pretty close to valid code that does what you want.

Re: Elevator Saga – An elevator programming game

#60
post #42

I wonder how much more efficient you could be, if people didn't just call for going up/down, but their destination floor.

They have that at work and it takes far longer to get an elevator. It's always annoying going to those buildings and using those elevators.
Post reply on HN