|
Variables "up" and "down" with values true and false attached to them. When it hits a boundary, the boundary that cant go anymore gets switched. And then you have a set of ifs that know what procedure to call based on these variables.
__________________
|