I took a software programming course in college. Actually, I took three or four.  One was a statistics course where we programmed in SAS. In another course that I can’t seem to remember, we coded in FORTRAN. But my major programming logic course used APL.  BTW, this was a long time ago.

I was thinking about a basic programming problem since my Mom started asking me this past weekend how an elevator knows where to go next.  So, for your amusement and my brain training, I’ll try to create the logic for a 5 story building with a single elevator….

Set up variables such as number of floors = 5, other floors are n, commands are gotowards (which includes close elevator do, start going), directions U & D

If “nothing else”, go to Floor 0, open door, wait
If on floor n and if “nothing else” and if someone walks into elevator and clicks on a button for floor n, close door and gotowards floor n. 

If heading towards floor n, and a call button on a floor between starting floor and n is pressed, and if its the same direction the elevator is heading. and if the floor hasn’t been past, stop at floor with call button pressed and let on visitor.  

If a button is pressed that has already been past or is NOT in the direction that the …


Durn this is hard and there’s no semantics or structure to my analysis.  I’ll go walk the dogs, go for a run, and try again later.  Great puzzle for me….