tideman.c
bool cyclecheck(int n, int m, int p)
{
    // base to exit recursive function. check if there is a cycle, if not cont.
    // printf("paircount = %i\n", n);
    int route = 0;
    int state = 0;

    if (n == 0)
    {
        return true;
    }

    if (locked[pairs[n - 1].winner][pairs[n - 1].loser] == true)
    {
        route = 1;
    }

    if (m == pairs[n - 1].loser && p == pairs[n - 1].winner)
    {
        state = 1;
    }
    else if (m == pairs[n - 1].loser)
    {
        state = 2;
    }

    if (route == 1 && state == 2)
    {
        m = pairs[n - 1].winner;
    }

    if (route == 1 && state == 1)
    {
        //printf("false\n");
        return false;
    }

    return cyclecheck(n - 1, m, p);
}
//establish new recursive function for lockedpairs
// m = winner candidate index in the checking pairs before it is about to be locked
// p = loser candidate index in the checking pairs before it is about to be locked
establish new recursive function for lockedpairs
m = winner candidate index in the checking pairs before it is about to be locked
p = loser candidate index in the checking pairs before it is about to be locked
establish new recursive function for lockedpairs m = winner candidate index in the checking pairs before it is about to be locked p = loser candidate index in the checking pairs before it is about to be locked
bool cyclecheck(int n, int m, int p)
{
    int route = 0;
    int state = 0;
    if (n == 0)
    {
        return true;
    }
    if (locked[pairs[n - 1].winner][pairs[n - 1].loser] == true)
    {
        route = 1;
    }
    if (m == pairs[n - 1].loser && p == pairs[n - 1].winner)
    {
        state = 1;
    }
    else if (m == pairs[n - 1].loser)
    {
        state = 2;
    }
    if (route == 1 && state == 2)
    {
        m = pairs[n - 1].winner;
    }
    if (route == 1 && state == 1)
    {
        return false;
    }
    return cyclecheck(n - 1, m, p);
}
bool cyclecheck ( int n , int m , int p ) { int route = 0 ; int state = 0 ; if ( n == 0 ) { return true ; } if ( locked [ pairs [ n - 1 ] . winner ] [ pairs [ n - 1 ] . loser ] == true ) { route = 1 ; } if ( m == pairs [ n - 1 ] . loser && p == pairs [ n - 1 ] . winner ) { state = 1 ; } else if ( m == pairs [ n - 1 ] . loser ) { state = 2 ; } if ( route == 1 && state == 2 ) { m = pairs [ n - 1 ] . winner ; } if ( route == 1 && state == 1 ) { return false ; } return cyclecheck ( n - 1 , m , p ) ; }
establish new recursive function for lockedpairs
m = winner candidate index in the checking pairs before it is about to be locked
p = loser candidate index in the checking pairs before it is about to be locked
establish new recursive function for lockedpairs m = winner candidate index in the checking pairs before it is about to be locked p = loser candidate index in the checking pairs before it is about to be locked
// base to exit recursive function. check if there is a cycle, if not cont. // printf("paircount = %i\n", n); //printf("false\n");