Exemplo n.º 1
0
int		ft_recursive_back(char **argv, int pos)
{
	char k;
	int x;
	int y;

	y = pos / 9;
	x = pos % 9;
	k = '1';
	if (pos < 0)
		return (1);
	if (argv[y][x] != '.')
		return (ft_recursive_back(argv, pos - 1));
	while (k <= '9')
	{
		if (ft_check_line(argv, y, k) && ft_check_column(argv, x, k) 
				&& ft_check_bloc(argv, k, y, x))
			{
				argv[y][x] = k;
				if (ft_recursive_back(argv, pos - 1) == 1)
					return (1);
			}
		k++;
	}
	argv[y][x] = '.';
	return (0);
}
Exemplo n.º 2
0
int		ft_check_case(int x, int y, struct s_grid *grid)
{
	if (ft_check_line(grid->lines[y]) && ft_check_column(grid->columns[x])
		&& ft_check_block(grid->blocks[ft_get_block_of(x, y)]) == 1)
		return (1);
	else
		return (0);
}