pile b ne fonctionne pas
This commit is contained in:
37
srcs/push.c
Normal file
37
srcs/push.c
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
t_list *pa(t_stack **a, t_stack **b, t_list **solution)
|
||||
{
|
||||
t_stack *tmp;
|
||||
|
||||
if (!(tmp = ft_calloc(1, sizeof(t_stack))))
|
||||
ps_stop(*a, *b, *solution, 2);
|
||||
tmp->n = (*b)->n;
|
||||
tmp->next = NULL;
|
||||
(*a)->next = tmp;
|
||||
fill_solution(solution, ft_strdup("pa"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_list *pb(t_stack **dst, t_stack **src, t_list **solution)
|
||||
{
|
||||
t_stack *a;
|
||||
t_stack *b;
|
||||
t_stack *tmp;
|
||||
|
||||
a = *src;
|
||||
b = *dst;
|
||||
|
||||
if (!(b = ft_calloc(1, sizeof(t_stack))))
|
||||
ps_stop(a, b, *solution, 2);
|
||||
b->n = a->n;
|
||||
b->next = NULL;
|
||||
|
||||
tmp = a->next;
|
||||
a->n = a->next->n;
|
||||
a->next = a->next->next;
|
||||
free(tmp);
|
||||
fill_solution(solution, ft_strdup("pa"));
|
||||
return (NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user