int algo(char **tab, int pos) { int x; int y; char k; x = pos % 9; y = pos / 9; k = '1'; if (pos == 81) return (0); if (tab[y][x] != ' ') return (algo(tab, (pos + 1))); while (k <= '9') { if ((algo_line(tab, y, k) == 0) && (algo_cols(tab, x, k) == 0) && (algo_square(tab, x, y, k) == 0)) { tab[y][x] = k; if (algo(tab, (pos + 1)) == 0) return (0); } k = k + 1; } tab[y][x] = ' '; return (1); }
void draw_line(Image* image, int x1, int y1, int x2, int y2, color_t color) { Data data = { image, color }; algo_line(x1, y1, x2, y2, &data, (AlgoPixel)pixel_for_image); }