Secret Santa

From Computer Science Wiki
Jump to: navigation, search
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

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

The Problem

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

  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 presentOffer for display, observation, examination or consideration. to. For example, person 1 gives a presentOffer for display, observation, examination or consideration. 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 listGive a sequence of brief answers with no explanation. (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

  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

Your solution will be graded using the following axis:

Scope

  1. To what extentConsider the merits or otherwise of an argument or concept. Opinions and conclusions should be presented clearly and supported with appropriate evidence and sound argument. 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.


DesignProduce a plan, simulation or model.

  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 designProduce a plan, simulation or model.


Style

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

References