mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +00:00
all basics functions has been tested we can start the sort algorithms
This commit is contained in:
44
main.c
44
main.c
@@ -6,35 +6,65 @@
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/08 18:32:35 by mteriier #+# #+# */
|
||||
/* Updated: 2025/12/08 20:36:49 by mteriier ### ########.fr */
|
||||
/* Updated: 2025/12/09 11:39:55 by mteriier ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void print_all_stack(t_stack *stack, t_stack *first)
|
||||
void print_all_stack(t_stack *stack, t_stack *first, char pile)
|
||||
{
|
||||
t_stack *tmp;
|
||||
int i;
|
||||
|
||||
tmp = stack;
|
||||
printf("TAB\n");
|
||||
i = 0;
|
||||
printf("TAB %c : \n", pile);
|
||||
if (!stack || !first)
|
||||
return ;
|
||||
while (tmp->next != first)
|
||||
{
|
||||
printf("[%d] ", tmp->value);
|
||||
tmp = tmp->next;
|
||||
i++;
|
||||
}
|
||||
printf("[%d] \n", tmp->value);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
t_stack *first;
|
||||
t_stacks *stacks;
|
||||
|
||||
stacks = NULL;
|
||||
if (argc > 1)
|
||||
{
|
||||
first = parsing(argc, argv);
|
||||
print_all_stack(first, first);
|
||||
stacks = init_big_stacks(argc, argv);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
sa(stacks);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
pb(stacks);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
pa(stacks);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
rra(stacks);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
pb(stacks);
|
||||
pb(stacks);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
rrb(stacks);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
rrr(stacks);
|
||||
print_all_stack(stacks->a, stacks->a, 'A');
|
||||
print_all_stack(stacks->b, stacks->b, 'B');
|
||||
}
|
||||
stack_clear_all(first, first);
|
||||
stack_clear_all(stacks->a, stacks->a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user