14.25 wPrefersM1OverM

This function returns true if point ‘w’ prefers player ‘m1’ over player ‘m’

bool NaoBehavior::wPrefersM1OverM(int prefer[2*NUM_AGENTS][NUM_AGENTS], int w, int m, int m1)
{
    // Check if w prefers m over her current engagment m1
    for (int i = 0; i < NUM_AGENTS; i++)
    {
        // If m1 comes before m in lisr of w, then w prefers her
        // cirrent engagement, don't do anything
        if (prefer[w][i] == m1)
            return true;
  
        // If m cmes before m1 in w's list, then free her current
        // engagement and engage her with m
        if (prefer[w][i] == m)
           return false;
    }
}