#include "push_swap.h" /* ** the nb compared to i in the while loop is the number ** of elements of the list that are competiting */ int match(t_stack **a) { t_stack *tmp; int smaller; int i; int j; tmp = *a; smaller = tmp->n; i = 1; j = 0; while (i < 4) { tmp = tmp->next; if (tmp->n < smaller) { smaller = tmp->n; j = i; } i++; } ft_printf("%i [%i]\n", smaller, j); return (j); } void nb_to_top(t_stack **a, t_list *solution, int i) { int n; if (!i) return ; n = i; while (--n) ra(a, &solution); n = i; sa(a, &solution); while (--n) { rra(a, &solution); sa(a, &solution); } } void hugo_sort(t_stack **a, t_stack **b, t_list *solution) { int i; i = match(a); nb_to_top(a, solution, i); (void)b; } /* 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); */