Thousands of birds follow only three local rules: avoid crowding, match nearby headings, and drift toward the flock.