Exemple #1
0
void	ft_resolve(t_list *begin_list, int tetrinb)
{
  t_list *list;
  char **str;
  int i;
  int x;

  x = 0;
  i = 0;
  list = begin_list;
  str = ft_tab_init(tetrinb);
  list = list->next;
  /*	while (list)
	{
	ft_putstr(list->str);
	ft_putstr("\n__________\n");
	list = list->next;
	}*/
    while (list)
    {
      while (ft_strcmp(gl_placetab[i].s, list->str) != 0 && i < 19)
	i++;
      str = ft_call_func(str, i, tetrinb, list->a);
      i = 0;
      list = list->next;
    }
        str = ft_resize_tab(str, tetrinb * 3);
    while (str[x])
      {
	ft_putendl(str[x]);
	x++;
      }
}
Exemple #2
0
int			main(void)
{
	t_node *tab[TAB_SIZE];

	ft_tab_init(tab);
	ft_read(tab);
	ft_search(tab);
	ft_tab_destroy(tab);
	return (0);
}
Exemple #3
0
int	ft_resolve(t_list *begin_list, int tetrinb)
{
    t_list *list;
    t_ret ret;
    int i;
    int count;
    t_alg *structure;
    int count2;

    ret.i = 0;
    count2 = 0;
    if (!(structure = (t_alg *)malloc(sizeof(t_alg) * tetrinb + 1)))
        return (0);
    count = tetrinb;
    i = 0;
    list = begin_list;
    ret.str = ft_tab_init(ft_sqrt(tetrinb * 4));
    list = list->next;
    while (list)
    {
        structure[count2].str = list->str;
        structure[count2].a = list->a;
        list = list->next;
        count2++;
    }
    structure[count2].str = NULL;
    count2 = 0;
    while (structure[count2].str != NULL)
    {
        while (ft_strcmp(gl_placetab[i].s, structure[count2].str) != 0 && i < 19)
            i++;
        ret = ft_call_func(ret, i, ft_sqrt(tetrinb * 4), structure[count2].a);
        i = 0;
        count2++;
        count--;
    }
    ft_putab(ret.str);
    return (0);
}