inessential by Brent Simmons

A Secret Santa Solution

At Omni we have a Swift Bike Shedding Club. Each week we meet to show our answers to the current question, and we get a new question.

Last week the question was from Ruby Quiz — our code had to assign secret Santas following a couple simple rules.

It sounds easier than it is. It’s not that hard, but it may not be obvious right away, either.

If you try it yourself, don’t read the “Quiz Summary” part of the page until after you’ve written your code. (It gives away too much.)

Also: don’t actually have your code send email.

And: don’t look at my solution until after you’ve done yours.