I think it is good to shuffle the team around. Helps with cross-pollination, and keeps the team area neat. Here is the function that we use to randomize our team making sure that you do not sit next to someone you are already sitting next to.
Note: Only works with teams greater than four. Assign each space in your office an number, the run the following. The first person in the outputted array goes in space 1, and so on.
importrandomdefall_perms(elements):iflen(elements)<=1:yieldelementselse:forperminall_perms(elements[1:]):foriinrange(len(elements)):#nb elements[0:1] works in both string and list contextsyieldperm[:i]+elements[0:1]+perm[i:]deffind_position(key,lizt):return[ifori,xinenumerate(lizt)ifx==key][0]defnew_neighbors(some_list):new_neighbor_list=some_list[:]list_size=len(some_list)fornew_neighbor_listinall_perms(some_list):printnew_neighbor_listtoo_many_neighbors=Falsefori,team_memberinenumerate(new_neighbor_list):#find position in inital listposition_in_original_list=find_position(team_member,some_list)original_neighbors=[]original_neighbors.append(some_list[(position_in_original_list+1)%list_size])original_neighbors.append(some_list[(position_in_original_list-1)%list_size])new_neighbors=[]new_neighbors.append(new_neighbor_list[(i+1)%list_size])new_neighbors.append(new_neighbor_list[(i-1)%list_size])delta=len(set(new_neighbors)-set(original_neighbors))#print "for {} comparing: {} with {} = {}".format(team_member,original_neighbors,new_neighbors,delta)ifnotdelta==2:too_many_neighbors=Truebreakiftoo_many_neighbors==False:returnnew_neighbor_listelse:print"No Matches"return[]# Usage team=['JT','FS','MC','MA','FD']new_seating=new_neighbors(team)printnew_seating# >> ['MC', 'JT', 'MA', 'PS', 'FD']
To end with an quote to motivate:
Everyday I’m shufflin’ — LMFAO
(you can play that music as you are shuffling’ seats)