debugage de dup stack a
This commit is contained in:
42
srcs/algo.c
42
srcs/algo.c
@@ -1,11 +1,51 @@
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
t_list *dup_n_fill(t_stack *a)
|
||||
{
|
||||
t_list *sort;
|
||||
int *i;
|
||||
int j;
|
||||
int *x;
|
||||
|
||||
j = 0;
|
||||
i = (int *)ft_calloc(3, sizeof(int));
|
||||
sort = NULL;
|
||||
while(a)
|
||||
{
|
||||
if(sort){x = sort->content; ft_printf("[%i / ", x[0]);}
|
||||
|
||||
i[0] = a->n;
|
||||
i[1] = j;
|
||||
i[2] = 0;
|
||||
|
||||
if(sort){x = sort->content; ft_printf("%i] ", x[0]);}
|
||||
|
||||
ft_lstadd_back(&sort, ft_lstnew(i));
|
||||
|
||||
x = sort->content; ft_printf("[%i]\n", x[0]);
|
||||
|
||||
a = a->next;
|
||||
j++;
|
||||
}
|
||||
return (sort);
|
||||
}
|
||||
|
||||
void hugo_sort(t_stack **a, t_stack **b, t_list *solution)
|
||||
{
|
||||
(void)b;
|
||||
(void)a;
|
||||
(void)solution;
|
||||
t_list *sort;
|
||||
|
||||
pb(b, a, &solution);
|
||||
sort = dup_n_fill(*a);
|
||||
int *i;
|
||||
while(sort)
|
||||
{
|
||||
i = sort->content;
|
||||
ft_printf("%i - %i - %i\n", i[0], i[1], i[2]);
|
||||
sort = sort->next;
|
||||
}
|
||||
/*
|
||||
sa(a, &solution);
|
||||
pb(b, a, &solution);
|
||||
|
||||
Reference in New Issue
Block a user