toutes les actions implementees
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,10 +9,17 @@ void hugo_sort(t_stack **a, t_stack **b, t_list *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);
|
||||
}
|
||||
|
||||
|
||||
+18
-7
@@ -1,14 +1,14 @@
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
t_list *rra(t_stack **stack, t_list **lst)
|
||||
void reverse_rotate(t_stack **stack)
|
||||
{
|
||||
t_stack *tmp;
|
||||
t_stack *before;
|
||||
|
||||
tmp = *stack;
|
||||
if (!tmp || !(tmp->next))
|
||||
return (NULL);
|
||||
return ;
|
||||
while (tmp->next)
|
||||
{
|
||||
before = tmp;
|
||||
@@ -17,15 +17,26 @@ t_list *rra(t_stack **stack, t_list **lst)
|
||||
tmp->next = *stack;
|
||||
*stack = tmp;
|
||||
before->next = NULL;
|
||||
}
|
||||
|
||||
t_list *rra(t_stack **a, t_list **lst)
|
||||
{
|
||||
reverse_rotate(a);
|
||||
fill_solution(*lst, ft_strdup("rra"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_list *rrb(t_stack **stack, t_list **lst)
|
||||
t_list *rrb(t_stack **b, t_list **lst)
|
||||
{
|
||||
t_stack *tmp;
|
||||
|
||||
tmp = *stack;
|
||||
reverse_rotate(b);
|
||||
fill_solution(*lst, ft_strdup("rrb"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_list *rrr(t_stack **a, t_stack **b, t_list **lst)
|
||||
{
|
||||
reverse_rotate(a);
|
||||
reverse_rotate(b);
|
||||
fill_solution(*lst, ft_strdup("rrr"));
|
||||
return (NULL);
|
||||
}
|
||||
t_list *rrr(t_stack **a, t_stack **b, t_list **lst);
|
||||
|
||||
+37
-3
@@ -1,7 +1,41 @@
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
t_list *ra(t_stack **stack, t_list **lst);
|
||||
t_list *rb(t_stack **stack, t_list **lst);
|
||||
t_list *rr(t_stack **a, t_stack **b, t_list **lst);
|
||||
void rotate(t_stack **stack)
|
||||
{
|
||||
t_stack *tmp;
|
||||
t_stack *first;
|
||||
|
||||
first = *stack;
|
||||
tmp = *stack;
|
||||
if (!tmp || !(tmp->next))
|
||||
return ;
|
||||
*stack = (*stack)->next;
|
||||
while (tmp->next)
|
||||
tmp = tmp->next;
|
||||
tmp->next = first;
|
||||
first->next = NULL;
|
||||
}
|
||||
|
||||
t_list *ra(t_stack **a, t_list **lst)
|
||||
{
|
||||
rotate(a);
|
||||
fill_solution(*lst, ft_strdup("ra"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_list *rb(t_stack **b, t_list **lst)
|
||||
{
|
||||
rotate(b);
|
||||
fill_solution(*lst, ft_strdup("rb"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_list *rr(t_stack **a, t_stack **b, t_list **lst)
|
||||
{
|
||||
rotate(a);
|
||||
rotate(b);
|
||||
fill_solution(*lst, ft_strdup("rr"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user