Secret Santa

From Computer Science Wiki
Revision as of 09:13, 30 November 2018 by Mr. MacKenty (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This a problem set for you to work through [1]

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[edit]

You have to think about conditionals , loops, and computational thinking here.

The Problem[edit]

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.[2]

Requirements[edit]

  1. You must ask how many participants are in the secret santa group
  2. 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.
    1. Once someone has been selected, they should be taken out of the secret santa pool. For example, person 1 should only have one person.
    2. A person must never have themselves. For example person 1 should never have person 1 as their secret santa.
    3. your output can be a simple list (person 1 -> person 4, person 2 -> person 9)
    4. Your output should be totally random, so each time we run the program we don't get the same results.


Take This Further[edit]

  1. 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[edit]

Your solution will be graded using the following axis:

Scope

  1. To what extent does your code implement the features required by our specification?
  2. Did the student try?
  3. Evidence of effort? If they tried, they get assessed.


Correctness

  1. Did code meet specifications?
  2. Did code meet unit tests?
  3. If it passes all unit tests, it earns a 5
  4. Check50: output is suggestive not determinative.


Design

  1. Is this code efficient?
  2. Are you you eliminating repetition?
  3. Are you using functions when you should?
  4. Code that is short is often a proxy for good design


Style

  1. Is your code formatted?
  2. Variables well named?
  3. Adhere to clean code

References[edit]