All Pages All Books|
|
|||
|
Quiz
|
19
|
||
|
Answer on page 195
|
|||
|
|
|||
|
Secret Santas
|
|||
|
|
|||
|
Honoring a long-standing (and fun) tradition started by my wife’s father, my friends play a Secret Santa game each year around Christmas time.
If you’re not familiar with how a Secret Santa game is played, you really are missing out on some fun. All players write their names on small pieces of paper that are folded up, placed in a hat, and mixed well. Each player then secretly draws a name in turn. Often the draw will have to be repeated a couple of times, until no players draw their own names. Santas then spend days surprising the person they drew with gifts and clues to Santa’s identity. This is a fun way to spread holiday cheer.
Unfortunately, the hat draw can be tedious. The system is prone to “Wait, I got myself...” problems, which can require several draws.
This year, my friends added a rule that further complicated the draw. Since we’re no good at hiding suspicious behavior from our spouses, we now prevent family members from drawing each other. This makes it harder to guess who has who. Unfortunately, we knew the hat would not stand up to the challenge.
The quiz is to replace our hat with a Secret Santa-choosing script.
Your script should accept a list of names on STDIN. Each line will contain a first name and a family name, separated by a space:
secret_santa/testdata Mr. Gray Mrs. Gray Mr. Thomas Mrs. Thomas Mr. Matsumoto Mrs. Matsumoto Mr. Fulton
|
|||
|
|
|||
|
|
|||
All Pages All Books