toutes les actions implementees
This commit is contained in:
BIN
builds/algo.o
BIN
builds/algo.o
Binary file not shown.
Binary file not shown.
BIN
builds/print.o
BIN
builds/print.o
Binary file not shown.
BIN
builds/push.o
BIN
builds/push.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
builds/rotate.o
BIN
builds/rotate.o
Binary file not shown.
BIN
builds/stop.o
BIN
builds/stop.o
Binary file not shown.
BIN
builds/swap.o
BIN
builds/swap.o
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);
|
pb(b, a, &solution);
|
||||||
|
pb(b, a, &solution);
|
||||||
|
pb(b, a, &solution);
|
||||||
pa(a, b, &solution);
|
pa(a, b, &solution);
|
||||||
sa(a, &solution);
|
sa(a, &solution);
|
||||||
sb(b, &solution);
|
sb(b, &solution);
|
||||||
sa(a, &solution);
|
sa(a, &solution);
|
||||||
rra(a, &solution);
|
rra(a, &solution);
|
||||||
|
rrb(b, &solution);
|
||||||
|
rrr(a, b, &solution);
|
||||||
|
ra(a, &solution);
|
||||||
|
rb(b, &solution);
|
||||||
|
rr(a, b, &solution);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
#include "push_swap.h"
|
#include "push_swap.h"
|
||||||
|
|
||||||
t_list *rra(t_stack **stack, t_list **lst)
|
void reverse_rotate(t_stack **stack)
|
||||||
{
|
{
|
||||||
t_stack *tmp;
|
t_stack *tmp;
|
||||||
t_stack *before;
|
t_stack *before;
|
||||||
|
|
||||||
tmp = *stack;
|
tmp = *stack;
|
||||||
if (!tmp || !(tmp->next))
|
if (!tmp || !(tmp->next))
|
||||||
return (NULL);
|
return ;
|
||||||
while (tmp->next)
|
while (tmp->next)
|
||||||
{
|
{
|
||||||
before = tmp;
|
before = tmp;
|
||||||
@@ -17,15 +17,26 @@ t_list *rra(t_stack **stack, t_list **lst)
|
|||||||
tmp->next = *stack;
|
tmp->next = *stack;
|
||||||
*stack = tmp;
|
*stack = tmp;
|
||||||
before->next = NULL;
|
before->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_list *rra(t_stack **a, t_list **lst)
|
||||||
|
{
|
||||||
|
reverse_rotate(a);
|
||||||
fill_solution(*lst, ft_strdup("rra"));
|
fill_solution(*lst, ft_strdup("rra"));
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_list *rrb(t_stack **stack, t_list **lst)
|
t_list *rrb(t_stack **b, t_list **lst)
|
||||||
{
|
{
|
||||||
t_stack *tmp;
|
reverse_rotate(b);
|
||||||
|
fill_solution(*lst, ft_strdup("rrb"));
|
||||||
tmp = *stack;
|
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);
|
return (NULL);
|
||||||
}
|
}
|
||||||
t_list *rrr(t_stack **a, t_stack **b, t_list **lst);
|
|
||||||
|
|||||||
@@ -1,7 +1,41 @@
|
|||||||
|
|
||||||
#include "push_swap.h"
|
#include "push_swap.h"
|
||||||
|
|
||||||
t_list *ra(t_stack **stack, t_list **lst);
|
void rotate(t_stack **stack)
|
||||||
t_list *rb(t_stack **stack, t_list **lst);
|
{
|
||||||
t_list *rr(t_stack **a, t_stack **b, t_list **lst);
|
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