Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Latest commit

 

History

History
18 lines (15 loc) · 934 Bytes

README.md

File metadata and controls

18 lines (15 loc) · 934 Bytes

Running the Script

  1. npm install
  2. npm run play <elevator start> <comma separated floors to visit>

Provided example would be as such: npm run play 12 2,9,1,32

Tests can be run using the test script npm run test

Assumptions

  1. There are only numbered floors (no G, M, L, etc)
  2. All valid floors are whole numbers
  3. All whole numbers are valid floors (no skipping 13)
  4. All consecutive floors are the same distance apart
  5. Time between consecutive floors is consistent, regardless of how many or few floors are traveled (elevator does not speed up during longer trips)
  6. Single floor travel time: 10 (Provided)
  7. It takes no time to stay on the same floor (the same floor multiple times in a row will not add to the travel time)
  8. Time spent stopped on a floor is not included in total travel time, as this is not time while traveling
  9. Floors are traveled between in order, without any optimizations in between