Last week was Stylight christmas party. A good occasion to have a little fun before the end of the year, see our founders dressed as Santa and add to the list of great company events.

It was also a good time for new & old employees to meet everyone, we just needed to avoid departments sitting together like in a high school dining hall. Of course we could rely on good will… or make a script. To make it more interesting, we switched tables after each course so you can’t even get groups for the night.

This is a very interesting problem, with a lot of very fancy solutions (like genetic algorithms, simulated annealing, or backtracking with heuristics…) which evaluate how good a table is and look for optimums. Then , naive backtracking had a worst case scenario of around 4e119 possibilities for us so let’s go simple.
For this simple meant do as you would by hand, just better. The script basically assign people to tables in sequence while testing if the table fits our criteria. Straightforward, fast and working !

Just get the script from the github repo and run it (needs node and coffeescript installed) :

[code language=”bash”] coffee -t tables -p people_per_table -o input_file

the input file need to be structured like this :

[code] department;name

It worked pretty well for us, so use and modify (github repo) as you wish and give us a shout @stylight_eng if you find new use case or improvements !

Interested in joining our xmas party next time ? We’re hiring !


About Author

Comments are closed.

%d bloggers like this: