Skip to main content

pick_slot

Function pick_slot 

Source
pub fn pick_slot<S: AsRef<str>>(
    agent_id: &str,
    taken: impl IntoIterator<Item = S>,
) -> &'static Slot
Expand description

The slot for a new agent: the least-used hue among taken (the stored colours of the agents that exist), ties broken by walking forward from the FNV-1a slot of the agent id, so the same id and the same set always give the same colour. With nothing taken it is the plain hash. Never Black or White: a neutral is only ever someone’s own choice.