I think what your friend is getting at, is you should be flowcharting EVERY floor. In programming, you should never have to repeat code for EVERY similar action. That's what loops are for.

Look at your floor 1 and floor 2 blocks, they're identical except for the direction the elevator travels and the floor number. What if you were making the flowchart for the Empire State Building? You going to have 102 blocks for every single floor? No, you're only going to have one block called "N floor" and checks for calls > N floor? Button for > N floor pressed? Check for calls to < N floor? Button for < N floor pressed? Then a way to determine if its got to move up or down.

The final logic should be something like:
I am on N floor. What was my last movement? Was the last movement up?

Yes: Are there any calls/button presses for > N floor? Yes: keep going up. No: are there any calls/button presses for < N floor? Yes: go down. No: There are no requests, go to floor 1 and park.

No: Last movement was down, are there any calls/button presses for < N floor? Yes: keep going down. No: are there any calls/button presses for > N floor? Yes: Go up. No: there are no requests, go to floor 1 and park.

Loop back to top.