int resolve(char **res, int pos, t_var var, int b) { if (var.tab[var.k] == 0) return (1); if ((b > 10000) || (var.k == 0 && pos == var.size * var.size)) return (0); if (var.k != 0 && pos == var.size * var.size) { var.mark = 0; pos = 0; return (remove_tetris(res, var, pos, b)); } var.i = pos / var.size; var.j = pos % var.size; if (res[var.i][var.j] != '.') return (resolve(res, pos + 1, var, b + 1)); if (check(res, var.tab[var.k], var, var.i) != 0) { var.alpha = put_tetris(res, var.tab[var.k], var) + 1; var.k++; pos = 0; if (resolve(res, pos, var, b + 1)) return (1); } else return (resolve(res, pos + 1, var, b + 1)); return (0); }
int check_file(t_list **lst, int fd) { char c; t_maillon *tetris; if (!(tetris = (t_maillon*)malloc(sizeof(t_maillon)))) return (0); while (1) { if (!(get_fd(tetris, fd))) return (0); if (!(read_one_c(&c, fd))) return (0); if (!(check_tetris(tetris->tab))) return (0); put_tetris(lst, *tetris); if (c == 0) break ; } return (1); }