Running coffee shuffles so we can get to know a group of folks.
Group for Randy Shoup’s directs in EEE
People |
---|
Brad |
DVC |
Gary |
Homayoun |
Justin |
Matt |
Scott |
Vince |
Wyatt |
Zhong |
Nandha |
Script. Press C-c C-c
to print output
# Old script. Does strictly random pairings.
from random import shuffle, choice
if len(people) % 2 != 0:
people.append(choice(people))
shuffle(people)
pairings = list(zip(people[::2], people[1::2]))
return [[a[0],b[0]] for a,b in pairings]
So this script should shift participants each month. We start with our main list. The first person gets pair with someone $offset (aka month number) away. Both parties are removed from the list. Repeat until done. Pair anyone left over with a random person.
from itertools import cycle
import datetime
import random
dt = datetime.datetime.now()
offset = dt.month
count = len(people)
is_odd = count % 2 == 0
half_way = int(count/2)
result = []
remaining = people.copy()
while len(remaining) != 0:
idx = offset % len(remaining)
if idx == 0:
idx += 1
if len(remaining) == 1:
result.append([remaining[0], random.choice(people)])
remaining.pop(0)
else:
result.append([remaining[0], remaining[idx]])
remaining.pop(idx);
remaining.pop(0)
# result = []
# for i, person in enumerate(people[:half_way]):
# # +1 here is to get the last person in the list, else it skips them.
# result.append([person, people[(i+offset+1)%count], i, half_way, offset, count])
return result