main.c
/*
 * Function: load
 * --------------
 * Load a board from a given file
 *
 */
load

Load a board from a given file
load Load a board from a given file
void load(FILE * fp) {
    int x = 0, y = 0, c, flag = 0;
    while (EOF != (c = fgetc(fp))) {
        if (x > BOARD_SIZE || y > BOARD_SIZE) {
            printf("Board max width or height is %d\n", BOARD_SIZE);
            exit(0);
        }
        if (c == 226 || c == 150) {
            continue;
        }
        if (c == '\n') {
            y += 1;
            x = 0;
            continue;
        }
        if (flag == 1) {
            board[1 + y][++x] = c == 136 ? 1 : 0;
            flag = 0;
        } else {
            flag = 1;
        }
    }
}
void load ( FILE * fp ) { int x = 0 , y = 0 , c , flag = 0 ; while ( EOF != ( c = fgetc ( fp ) ) ) { if ( x > BOARD_SIZE || y > BOARD_SIZE ) { printf ( " \n " , BOARD_SIZE ) ; exit ( 0 ) ; } if ( c == 226 || c == 150 ) { continue ; } if ( c == ' \n ' ) { y += 1 ; x = 0 ; continue ; } if ( flag == 1 ) { board [ 1 + y ] [ ++ x ] = c == 136 ? 1 : 0 ; flag = 0 ; } else { flag = 1 ; } } }
Function: load
Function : load
//Ignore similar chars in the unicode characters used the view the map //Move to the next row in the matrix //Ignore one character because any char being used twice to create visualy a square