servant_golem
For late joiners, we're forced to put them in an alone department at some point.
This is because reusing the round-start algorithm would force existing officers into a different department in order to preserve having partners at all times.
This would mean retroactively updating their access as well, which is too much of a headache for me to want to bother.
So, here's the method. If any department currently has 1 officer, they are forced into that.
Otherwise, the department with the least officers in it is chosen. Preference takes priority, meaning that if both medical and engineering have zero officers, and the preference is medical, then medical is what will be chosen.
Just like get_officer_departments
, this function is deterministic.
Randomness should instead be handled in the shuffling of the departments
argument.