Distancing

Occupying seats while maintaining minimum separation distance

def TooClose (elm:var[]..[],min)
{
	pnt1 = List.FirstItem(elm.GetLocation());
	elm2 = List.RestOfItems(elm);
	pnt2 = elm2.GetLocation();
	bln1 = pnt1.DistanceTo(pnt2) < min;
	elm3 = List.FilterByBoolMask(elm2,bln1)["out"];
	return elm3;
};

def Distancing (elm:var[]..[],min)
{
	return = [Imperative]
	{
		if (List.Count(elm)>1)
		{
			elm1 = [List.FirstItem(elm)];
			c = 1;
			while (List.Count(elm) > 1)
			{
				elm2 = TooClose (elm,min);
				elm1[c] = List.FirstItem(elm2);
				elm = elm2;
				c = c + 1;
			}
			return elm1;
		}
		else
		{
			return elm;
		}
	}
};

Last updated