js5/js5.py
2025-11-25 14:28:53 -08:00

37 lines
No EOL
1 KiB
Python

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}")