
auta = [a1,a2,a3,a4,a5,a6,a7,a8];
stoji = [];

#LOOPTest
~10
@("(vehicle aP distance _x) > 500" count auta > 0) or ("(vehicle aP distance _x) < 500" count stoji > 0)

_a = 0;

#LOOPIn

_b = count auta;
_c = count stoji;
_kolik = _c;
? _b > _c : _kolik = _b;

? _a >= _kolik : goto "LOOPTest"

? _a >= _b : goto "SkipIN"
? (vehicle aP distance (auta select _a) > 500) : (auta select _a) stop true; stoji = stoji + [(auta select _a)]; auta = auta - [(auta select _a)];
#SkipIN

? _a >= _c : goto "SkipOUT"
? (vehicle aP distance (stoji select _a) < 500) : (stoji select _a) stop false; auta = auta + [(stoji select _a)]; stoji = stoji - [(stoji select _a)]
#SkipOUT

_a = _a + 1;

goto "LOOPIn"
