The Elevator

This is another assignment for the Viking Code School

You live in a 25 story building with one elevator. The central microcontroller got eaten by rats and the building manager has asked you to code up the elevator’s operating procedure until he can get a new one. You figure you’ll have to learn to actually code soon but you first want to think things through and pseudocode your design.



The Task

Your job is to design a properly working elevator. It should stop on each floor it is physically able to during a given trip to pick up whoever is going the same direction. Additionally, make sure that no one is:

  1. smashed into the ground
  2. pushed through the roof
  3. squished by the doors
  4. let off in between floors
  5. stuck going the wrong direction (unless they choose not to exit)

This will be good practice thinking about all the edge cases and scenarios that a user can do.

The point isn’t to follow any strict guidelines of syntax but rather to focus on getting the logic of the problem figured out and then organizing it into modules that accomplish the sub-tasks that are required.

Think about:

  • Using a loop around everything to keep your pseudocode (and elevator) running.
  • Writing everything in one giant mess to start with and then refactoring it to break apart the modules so it feels less cluttered and messy.


This is Pseudo-Code.




Copyright 2017. All rights reserved.

Posted November 10, 2016 by Edmundo in category "Daily