Exemple #1
0
void	ft_tetra_print(t_tetra **list)
{
	t_tetra		*temp;

	temp = *list;
	while (temp != NULL)
	{
		ft_putab(temp->pos);
		ft_putendl("");
		temp = temp->next;
	}
}
Exemple #2
0
int		main(int ac, char **av)
{
	t_tetra		*list;
	int			fd;

	if (ac != 2)
	{
		ft_putstr("error\n");
		return (0);
	}
	else
		fd = open(av[1], O_RDONLY);
	if (ft_file_parser(fd, &list) < 0 || ((ft_tetra_len(&list)) > 26))
		ft_putstr("error\n");
	else
		ft_putab(ft_launch_fillit(&list));
	close(fd);
	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);
}