Giter Club home page Giter Club logo

elevator's Introduction

Elevator Challenge

Description

For this challenge, you will be implementing an API for an elevator with JavaScript. While it may seem trivial, you will quickly find out all the nuances of the elevator world and be marveled that they work as well as they do. You cannot move on to the next Level unless you have completed the current Level (or made a valiant effort).

We will focus heavily on TDD and writing super clean code. You will then whiteboard and explain your implementation and defend your logic decisions to the instructors. We will be considering the following criteria:

  • Code Quality
  • Robustness of test suite
  • Efficiency of elevator algorithm
  • Number of Levels completed

Level 0

  • Pencil and paper out the elevator process. What kinds of things do you need to keep track of? What is a modern elevator's pickup and drop off strategy?

Level 1

  • Build two Javascript classes - Elevator and Person. A person should be able to request a drop off floor. The elevator should be able to pick up the person on their current floor and drop them off on the requested floor.

  • Elevator properties:

    • When a class of Elevator is instantiated, it should start on floor 0 (lobby).
    • It should be able to keep track of it's current floor.
    • It should be able to keep track of how many total floors it has traversed and how many total stops it has made.
    • It should store a collection of requests and a collection of current riders on the elevator.
    • It has one of three statuses at any given moment: "idle", "moving", and "broken".
  • Person properties:

    • Name
    • Current floor

Level 2

  • Create a test suite that tests the following scenarios:
    • Person A goes up.
    • Person A goes down.
    • Both tests should assert total number of stops and floors the elevator traversed.
    • There should also be a unit test for every Elevator method.

Level 3

  • Create the ability for multiple people to request drop off floors. The elevator should pick up and drop off each person in order of the requests. For example:
    • Bob is on floor 3 and requests to go to floor 9.
    • Sue is on floor 6 and requests to go to floor 2.
    • The elevator will pick up Bob, drop him off on floor 9, then pick up Sue and drop her off on floor 2.

Level 4

  • Add to your test suite that tests the following scenarios with the assumption that Person A sends an elevator request before Person B:
    • Person A goes up, Person B goes up.
    • Person A goes up, Person B goes down.
    • Person A goes down, Person B goes up.
    • Person A goes down, Person B goes down.
    • All four tests should assert total number of stops and floors the elevator traversed.
    • All four tests should assert the total number of requests and current riders.

Level 5

  • Have the elevator return to floor 0 (lobby) if there are no current riders in the elevator and the current time is before 12:00 p.m.
  • Have the elevator stay on current floor of last drop off if there are no current riders in the elevator and the current time is after 12:00 p.m.

Level 6

  • Create a more efficient algorithm for pickups and drop offs. Whatever algorithm you chose needs to be tested against the same four Level 4 situations and show for each situation the elevator traversed less total floors.

Level 7

  • Create a DOM representation of the elevator and people to visualize the elevator process.

Level 8

  • Replace all insertions and deletions of requests and current riders with API calls to a Node/Express backend with the correct CRUD methods.

elevator's People

Contributors

alex-tideman avatar brittanydionigi avatar tbrandle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.