first commit :3
This commit is contained in:
commit
6a6ecabe4c
2 changed files with 70 additions and 0 deletions
37
js5.py
Normal file
37
js5.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import random
|
||||
import base64
|
||||
|
||||
# Modify
|
||||
participants = [
|
||||
"Alice",
|
||||
"Bob",
|
||||
"Carol",
|
||||
"Dawn",
|
||||
"Eve"
|
||||
]
|
||||
|
||||
# this is just a lot of junk to make sure all the base64 text is somewhat visually indistinct
|
||||
def get_recipient_text(recipient):
|
||||
format_strings = [
|
||||
"{} is your secret santa recipient",
|
||||
"your target for secret santa is {}",
|
||||
"you've been assigned {} for secret santa",
|
||||
]
|
||||
salts = [
|
||||
":3",
|
||||
"^_^",
|
||||
"=^.^=",
|
||||
"o.O",
|
||||
">:3c",
|
||||
]
|
||||
return random.choice(format_strings).format(recipient) + " " + random.choice(salts)
|
||||
|
||||
# make a random loop of all participants, assigning each person to the next
|
||||
random.shuffle(participants)
|
||||
recipients = list(map(lambda s: base64.b64encode((get_recipient_text(s)).encode('utf-8')).decode('utf-8'), participants))
|
||||
participants = participants[1:] + participants[:1] # list rotation
|
||||
assignments = list(zip(participants, recipients))
|
||||
random.shuffle(assignments)
|
||||
|
||||
for participant, recipient in assignments:
|
||||
print(f"{participant}: {recipient}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue