-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperation2.c
56 lines (48 loc) · 1.58 KB
/
operation2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* operation2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sanglee2 <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/18 17:33:31 by sanglee2 #+# #+# */
/* Updated: 2023/02/18 17:34:29 by sanglee2 ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ra(t_stack *stack)
{
push_bot(stack, stack->a_top); // a_top에 있던 원래의 것들을 잘 제거. 잘라야 함.
stack->a_top = stack->a_top->next;
write(1, "ra\n", 3);
}
void rb(t_stack *stack)
{
push_bot(stack, stack->b_top);
stack->b_top = stack->b_top->next;
write(1, "rb\n", 3);
}
void rr(t_stack *stack)
{
ra(stack);
rb(stack);
write(1, "rr\n", 3);
}
void rra(t_stack *stack)
{
push_top(stack, stack->a_bot);
stack->a_bot = stack->a_bot->prev;
write(1, "rra\n", 4);
}
void rrb(t_stack *stack)
{
push_top(stack, stack->b_bot);
stack->b_bot = stack->b_bot->prev;
write(1, "rrb\n", 4);
}
void rrr(t_stack *stack)
{
rra(stack);
rrb(stack);
write(1, "rrr\n", 4);
}