示例#1
0
文件: main.c 项目: Blanchard-A/Sudoku
void	resolve_sudo(char *str, int num)
{
  int	**map;
  int	*order_priority;

  if (num > 0)
    printf("####################\n");
  if ((order_priority = malloc(sizeof(int) * (81))) == NULL)
    return ;
  map = NULL;
  map = mllc_map(map);
  put_nbr_in_map_to_2d(str, map, num);
  if ((check_error_solvable(map)) == -1)
    {
      show_X();
      return ;
    }
  put_priority_in_map(map);
  get_order_to_resolve(order_priority, map);
  replace_all_zero(map, 0, order_priority);
  if ((check_error_solvable(map)) == -1)
    {
      show_X();
      return ;
    }
  show_map(map);
  free_tabs(order_priority, map);
}
示例#2
0
int				main(int ac, char **av)
{
	t_env		env;

	if (ac != 3)
		return (0);
	if (!(env.game = init_board(ft_atoi(av[1]), ft_atoi(av[2]), &env)))
		return (0);
	srand (time(NULL));
	env.start = rand() % 2 + 1;
	if (env.start == 2)
		play_IA_first(&env);
	render_set(env.x, env.y, &env);
	if (!while_ft(env))
		return (free_tabs(&env));
	return (0);
}