49 lines
723 B
C
49 lines
723 B
C
|
|
#include "push_swap.h"
|
|
|
|
t_list *dup_n_fill(t_stack *a)
|
|
{
|
|
t_list *sort;
|
|
int *i;
|
|
int j;
|
|
|
|
j = 0;
|
|
sort = NULL;
|
|
while(a)
|
|
{
|
|
i = (int *)ft_calloc(3, sizeof(int));
|
|
i[0] = a->n;
|
|
i[1] = j;
|
|
i[2] = 0;
|
|
ft_lstadd_back(&sort, ft_lstnew(i));
|
|
a = a->next;
|
|
j++;
|
|
}
|
|
return (sort);
|
|
}
|
|
|
|
void hugo_sort(t_stack **a, t_stack **b, t_list *solution)
|
|
{
|
|
(void)b;
|
|
(void)a;
|
|
(void)solution;
|
|
|
|
sa(a, &solution);
|
|
pb(b, a, &solution);
|
|
pb(b, a, &solution);
|
|
pb(b, a, &solution);
|
|
pb(b, a, &solution);
|
|
pb(b, a, &solution);
|
|
pa(a, b, &solution);
|
|
sa(a, &solution);
|
|
sb(b, &solution);
|
|
sa(a, &solution);
|
|
rra(a, &solution);
|
|
rrb(b, &solution);
|
|
rrr(a, b, &solution);
|
|
ra(a, &solution);
|
|
rb(b, &solution);
|
|
rr(a, b, &solution);
|
|
}
|
|
|