Comments (5)
Good point. I have thought about this in the past and there are some todos in the code, but I have not yet figured out a good design for this.
For example, have a look at these function stubs that are not used:
https://github.com/magwo/elevatorcrush/blob/master/elevator.js#L138
Would you want the "going up" and "going down" indications to be user-code controllable? Or do you think it should be automatic? As in.. if the next queued floor is above, then the elevator reports it is going up.
In other words, I'm not sure if this "going up/down" indicator is something that can always be deduced from the current travel queue, or if it is something that the scheduler/planner code needs to inform the system about - to reveal its intentions.
from elevatorsaga.
I think there are pro's and cons for both solutions. At first thought it seems logical to deduce the direction from the queue, but what if my only instruction is "go to floor X"? WIll people not get on because the queue is empty upon arrival?
On the other hand, if you make the users indicate the next direction, that will lead to additional difficulty for the earlier levels. (or all people get on if no direction is indicated)
By the way, thanks for the fun game and the quick reply :)
from elevatorsaga.
You could by default indicate both directions, but make it user controllable.
Also, in real life, there's always that one guy that steps into the wrong elevator, so maybe add a random chance a passenger ignores the indicated direction.
from elevatorsaga.
Yeah.. it's probably the best design, to make it default true for both direction and then expose setters and getters in the API..
elevator.goingUp(true);
if(elevator.goingDown()) { ... }
etc.
from elevatorsaga.
Added support for this, just need to update the documentation.
elevator.goingUpIndicator() // true by default
elevator.goingUpIndicator(false) // set to false
from elevatorsaga.
Related Issues (20)
- Add a restart button while running elevator HOT 2
- On MS Edge, clicking "Next Challenge" doesn't do anything HOT 2
- Doesn't work on Chromium HOT 1
- Provide a "playground" mode where you can try out for debugging purpose
- Elevator moves while passengers enter the elevator
- Can't select code on Android Chrome
- Allow importing libraries?
- how are we supposed to know how many elevators we have access to? HOT 3
- How to update world (floors,elevators count) without changing challenge?
- Passengers not rehitting button
- Only last configured elevator behaves HOT 2
- Is this repo will be maintend HOT 4
- New levels based on real life
- I don't get this error HOT 2
- Turn off the code auto-formatter HOT 1
- Sharing Website doesn't load a preview-image
- Bug: User doesn't enter the elevator when it stops enroute HOT 1
- TypeScript for the API HOT 2
- Specify which passenger waited too long. HOT 4
- goingUp and goingDown indicators are always true HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elevatorsaga.