About this task
Still thinking about method,
which is just as important as language, let
us take another look at CATMOUSE EXEC.
The program is about a cat and a mouse and their positions in a
corridor. At some stage their positions will have to be pictured on
the screen. The whole thing is too complicated to think about all
at once; the first step is to break it down into:
- Main program: calculate their positions
- Display subroutine: display their positions.
Now let us look at main program. The user (who plays the mouse)
will want to see where everybody is before making a move. The cat
will not. The next step is to break the main program down further,
into:
Do forever
call Display
Mouse's move
Cat's move
end
Conclusion