diff --git a/builds/algo.o b/builds/algo.o index 99b8e65..675259d 100644 Binary files a/builds/algo.o and b/builds/algo.o differ diff --git a/push_swap b/push_swap index 98af2a0..04fb12f 100755 Binary files a/push_swap and b/push_swap differ diff --git a/srcs/algo.c b/srcs/algo.c index 7a84600..37c3f8d 100644 --- a/srcs/algo.c +++ b/srcs/algo.c @@ -284,47 +284,36 @@ void sort_5(t_stack **a, t_list *solution) { int order; -48 67 83 54 65 -1 4 5 2 3 - -21 34 20 17 28 -3 5 2 1 4 - -11 13 12 7 10 -3 4 5 1 2 - -6 -3 -12 2 5 -5 2 1 3 4 - - ra(a, &solution); - sa(a, &solution); - rra(a, &solution); +// algos de 5 uniquement necessaires pour trier cette liste : +// 5 10 2 7 65 -12 -3 6 12 28 17 13 54 83 20 11 34 21 67 48 +// 48 67 83 54 65 | 21 34 20 17 28 | 11 13 12 7 10 | 6 -3 -12 2 5 +// 1 4 5 2 3 | 3 5 2 1 4 | 3 4 5 1 2 | 5 2 1 3 4 order = order_is(*a, 5); if (order == 12345) { - s - r - s - r - s - r - s - rr - rr - rr - s - r - s - r - s - rr - rr - s - r - s - rr - s + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); + rra(a, &solution); + rra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); + rra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); + sa(a, &solution); } /* else if (order == 12354) @@ -344,22 +333,21 @@ void sort_5(t_stack **a, t_list *solution) */ else if (order == 14253) { - |14253 - r 3|1425 - s 3|1452 - r 23|145 - s 23|154 - r 423|15 - s 423|51 - rr 23|514 - s 23|541 - rr 3|5412 - s 3|5421 - rr |54213 - s |54231 - r 1|5423 - s 1|5432 - rr |54321 + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); + sa(a, &solution); + rra(a, &solution); + sa(a, &solution); + rra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); } /* else if (order == 14325) @@ -425,17 +413,16 @@ void sort_5(t_stack **a, t_list *solution) */ else if (order == 34512) { - |34512 - r 2|3451 - r 12|345 - s 12|354 - r 412|35 - s 412|53 - rr 12|534 - s 12|543 - rr 2|5431 - rr |54312 - s |54321 + ra(a, &solution); + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); + sa(a, &solution); + rra(a, &solution); + rra(a, &solution); + sa(a, &solution); } /* else if (order == 34521) @@ -445,17 +432,16 @@ void sort_5(t_stack **a, t_list *solution) */ else if (order == 35214) { - |35214 - s |35241 - r 1|3524 - s 1|3542 - r 21|354 - r 421|35 - s 421|53 - rr 21|534 - s 21|543 - rr 1|5432 - rr |54321 + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); + sa(a, &solution); + rra(a, &solution); + rra(a, &solution); } /* else if (order == 35241) @@ -502,18 +488,17 @@ void sort_5(t_stack **a, t_list *solution) else if (order == 52134) { - |52134 - s |52143 - r 3|5214 - s 3|5241 - r 13|524 - s 13|542 - rr 3|5421 - rr |54213 - s |54231 - r 1|5423 - s 1|5432 - rr |54321 + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); + rra(a, &solution); + sa(a, &solution); + ra(a, &solution); + sa(a, &solution); + rra(a, &solution); } /* else if (order == 52143)