The pathfinding engine already exists (try the w< command).