Buy:
|
Secret Santa Scratch Tutorial
How it works
The program works by picking a name at random from a list and then pairing them up with another name from the list. Each person must keep their pairing a secret and either buy or make a gift for the person they have been drawn with. For example:
Kyle is paired with Aiden
Millie is paired with Dave
Archie is paired with Oliver
Try it:
Kyle is paired with Aiden
Millie is paired with Dave
Archie is paired with Oliver
Try it:
Description
In this tutorial, you will code a Secret Santa name picker. The program works by picking a name at random from a list and then pairing them up with a name from the second list. Each person must keep their pairing a secret and either buy or make a gift for the person they have been drawn with.
Start by running the following code sample. Challenge: Can you predict what will happen before revealing the answer.
In this tutorial, you will code a Secret Santa name picker. The program works by picking a name at random from a list and then pairing them up with a name from the second list. Each person must keep their pairing a secret and either buy or make a gift for the person they have been drawn with.
Start by running the following code sample. Challenge: Can you predict what will happen before revealing the answer.
Challenge 1:
Click on the link for the sorting hat example (below) and modify the code so that it picks a name from a list at random.
Sorting hat code:
https://scratch.mit.edu/projects/613053267
Click on the link for the sorting hat example (below) and modify the code so that it picks a name from a list at random.
Sorting hat code:
https://scratch.mit.edu/projects/613053267
Challenge 2:
Currently, the random name picker can pick the same name several times. Modify your name picker so that it removes a name from the list once it is picked so that the name cannot be picked again.
Hint: Add the following block to the end of your program:
Currently, the random name picker can pick the same name several times. Modify your name picker so that it removes a name from the list once it is picked so that the name cannot be picked again.
Hint: Add the following block to the end of your program:
Final challenge:
Click on the link to the partially working example (below) and modify your code so that it picks two names at random from the list and prints out the names. For example:
Alex is paired with Kyle
Millie is paired with Dave
Worked example:
https://scratch.mit.edu/projects/613125144
Example:
Click on the link to the partially working example (below) and modify your code so that it picks two names at random from the list and prints out the names. For example:
Alex is paired with Kyle
Millie is paired with Dave
Worked example:
https://scratch.mit.edu/projects/613125144
Example:
Taking it further
Modify your code so that that it pairs everyone in the list.
Top tip: You will need to use a loop. For example:
Modify your code so that that it pairs everyone in the list.
Top tip: You will need to use a loop. For example:
Bonus Challenge
Create a random group picker that places people into groups of 4 or 5.
Create a random group picker that places people into groups of 4 or 5.