Robson » Little Red Book » Lift simulation

Chapter 7 - Question 12

Simulate the action of a lift.

Use sections of the keyboard as the call buttons in the lift and on each floor of a building.

A simple block graphic diagram on a VDU screen can be used to show the movement of the lift in response to the keyboard.

Note: This problem is only solvable on systems with an accessible clock interupt.

Solution 1

PHP wasn't designed for this type of problem and I don't know enough about C++ to create it in that language. So I've gone back to my first programming language, Visual Basic, to create the solution.

Here's a screenshot:

Lift simulation application

The user presses the keys 1 to 4 to make the lift go to that floor. If the lift is in motion, the call is ignored. That's about it ;)

Download the Lift Simulation VB Project (2.04KB)


© 2004-19 robson | cc unless stated