Structure of Motion Rule

%the real local motion rule for equigrouping is encoded in this file;  (this file itself is
%not the rule, but rather where you would put yours)

%the call syntax is:
%function[pos_action]= local_rule(b,p);

%the input is the local ball b and the integer p describing the size of the
%equigrouping pattern to be created

b = [1 0 0 1 0 1 1]
p = 3

%the output is the action that the rule takes, i.e. a number 1, 0 or -1.

%for example:

pos_action = (sum(b) < (4-p)) - (sum(b) >= (4-p))   %this rule DOES NOT ACHIEVE EQUIGROUPING!
b =

     1     0     0     1     0     1     1


p =

     3


pos_action =

    -1