src/header/move.c
// Returns an integer indicating whether there is a wall on the board b
// at position starting from (column, line), in a direction that is either
// towards smaller cols (0), smaller lines (1), larger cols (2) or larger lines (3).
Returns an integer indicating whether there is a wall on the board b
at position starting from (column, line), in a direction that is either
towards smaller cols (0), smaller lines (1), larger cols (2) or larger lines (3).
Returns an integer indicating whether there is a wall on the board b at position starting from ( column line ) in a direction that is either towards smaller cols ( 0 ) smaller lines ( 1 ) larger cols ( 2 ) or larger lines ( 3 ) .
int is_passable(const struct board* b, char column, char line, char direction)
{
    int res = 1;
    int l = toBoardcoor(line);
    int c = toBoardcoor(column);
    switch (direction)
    {
        case 0:
            if (c == 0)
                res = 0;
            else if (b->t[l][c - 1])
                res = 0;
            break;
        case 1:
            if (l == 0)
                res = 0;
            else if (b->t[l - 1][c])
                res = 0;
            break;
        case 2:
            if (c == 16)
                res = 0;
            else if (b->t[l][c + 1])
                res = 0;
            break;
        case 3:
            if (l == 16)
                res = 0;
            else if (b->t[l + 1][c])
                res = 0;
            break;
        default:
            break;
    }
    return res;
}
int is_passable ( const struct board * b , char column , char line , char direction ) { int res = 1 ; int l = toBoardcoor ( line ) ; int c = toBoardcoor ( column ) ; switch ( direction ) { case 0 : if ( c == 0 ) res = 0 ; else if ( b -> t [ l ] [ c - 1 ] ) res = 0 ; break ; case 1 : if ( l == 0 ) res = 0 ; else if ( b -> t [ l - 1 ] [ c ] ) res = 0 ; break ; case 2 : if ( c == 16 ) res = 0 ; else if ( b -> t [ l ] [ c + 1 ] ) res = 0 ; break ; case 3 : if ( l == 16 ) res = 0 ; else if ( b -> t [ l + 1 ] [ c ] ) res = 0 ; break ; default : break ; } return res ; }
Returns an integer indicating whether there is a wall on the board b
at position starting from (column, line), in a direction that is either
towards smaller cols (0), smaller lines (1), larger cols (2) or larger lines (3).
Returns an integer indicating whether there is a wall on the board b at position starting from ( column line ) in a direction that is either towards smaller cols ( 0 ) smaller lines ( 1 ) larger cols ( 2 ) or larger lines ( 3 ) .