Wanderer Package Separate Function
MC logo
 

Wanderer Package Separate Function

Ada Code Examples


<<Wanderer Package Body Download Wanderer Client>>
separate(Wander)
-- If I want to walk home from where I am now, which way should I start,
-- and how far should I go in that direction?  If I am home, the
-- direction will be Stop, and the distance will be zero.
function Toward_Home(L: Locator) return Direction_Instruction is
begin
    if L.NS > 0 then
       return South;
    elsif L.NS < 0 then
       return North;
    elsif L.EW > 0 then
       return West;
    elsif L.EW < 0 then
       return East;
    else
       return Stop;
    end if;
end Toward_Home;
<<Wanderer Package Body Wanderer Client>>