This is a problem set. Some of these are easy, others are far more difficult. The purpose of these problems sets are to HELP YOU THINK THROUGH problems.
What is this problem set trying to do
Secret Santa is a Christmas ritual involving a group of people exchanging anonymous gifts. Participants names are placed in a hat and each person draws a name for whom they are to buy a gift. Presents are then exchanged anonymously. There is usually a gift giving occasion, where all the presents are placed on a table, with the name of the receiver, but not the giver.
- You must ask how many participants are in the secret santa group
- You must then write a program which randomly assigns one person another person to give a present to. For example, person 1 gives a present to person 2.
- Once someone has been selected, they should be taken out of the secret santa pool. For example, person 1 should only have one person.
- A person must never have themselves. For example person 1 should never have person 1 as their secret santa.
- your output can be a simple list (person 1 -> person 4, person 2 -> person 9)
- Your output should be totally random, so each time we run the program we don't get the same results.
Take This Further
- We are just using numbers to represent people. It would be better to use names. For example, if I have 20 students, your program would ask for 20 names. Then you would run your secret santa algorithm as above.
How you will be assessed
Your solution will be graded using the following axis:
- To what extent does your code implement the features required by our specification?
- Did the student try?
- Evidence of effort? If they tried, they get assessed.
- Did code meet specifications?
- Did code meet unit tests?
- If it passes all unit tests, it earns a 5
- Check50: output is suggestive not determinative.
- Is this code efficient?
- Are you you eliminating repetition?
- Are you using functions when you should?
- Code that is short is often a proxy for good design
- Is your code formatted?
- Variables well named?
- Adhere to clean code