This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
init: function(elevators, floors) { | |
function getLeastBusyElevator(elevators) { | |
return elevators.reduce(function (currentLeast, thisElevator) { | |
if (thisElevator.destinationQueue.length < currentLeast.destinationQueue.length && | |
thisElevator.loadFactor() < 0.75 | |
) { | |
return thisElevator; | |
} else { | |
return currentLeast; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Promise = require('bluebird'); | |
const _ = require('lodash'); | |
const path = require('path'); | |
const fs = Promise.promisifyAll(require('fs')); | |
const DEBUG = true; | |
const FILENAME = './gc'; | |
const RUBBISH_THRESHOLD = 5; | |
const ALPHA_REGEX = /^[a-zA-Z\s]+$/; |
OlderNewer