From 6be6c78c8856b14c19a1958dfa3993cc0ced1b3f Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 19 Jan 2020 14:21:53 +0100 Subject: Added stack operation visualizer, random stack generator, quick sort of some sort (WIP) --- src/push_swap/stack_wrapper.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/push_swap/stack_wrapper.c (limited to 'src/push_swap/stack_wrapper.c') diff --git a/src/push_swap/stack_wrapper.c b/src/push_swap/stack_wrapper.c new file mode 100644 index 0000000..df44e23 --- /dev/null +++ b/src/push_swap/stack_wrapper.c @@ -0,0 +1,40 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* stack_wrapper.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/19 13:05:58 by cacharle #+# #+# */ +/* Updated: 2020/01/19 13:17:18 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "push_swap.h" + +void stack_swap_print(t_stack *stack) +{ + if (stack->tag == STACK_A) + ft_putendl("sa"); + if (stack->tag == STACK_B) + ft_putendl("sb"); + stack_swap(stack); +} + +void stack_rotate_print(t_stack *stack) +{ + if (stack->tag == STACK_A) + ft_putendl("ra"); + if (stack->tag == STACK_B) + ft_putendl("rb"); + stack_rotate(stack); +} + +void stack_push_to_print(t_stack *from, t_stack *to) +{ + if (to->tag == STACK_A) + ft_putendl("pa"); + if (to->tag == STACK_B) + ft_putendl("pb"); + stack_push_to(from, to); +} -- cgit