-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_swap.h
70 lines (59 loc) · 2.2 KB
/
push_swap.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: issierra <issierra@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/30 08:46:36 by issierra #+# #+# */
/* Updated: 2023/12/26 09:11:24 by issierra ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
# include "./libft/libft.h"
# define INT_MAX 2147483647
# define INT_MIN -2147483648
# define STDERR 2
typedef struct s_stack
{
int nbr;
int idx;
int cost;
int ab_medium;
int cheapest;
struct s_stack *target;
struct s_stack *next;
} t_stack;
t_stack *str_to_stack(char const *s, char c);
int check_arg(int argc, char **arg, int i);
t_stack *create_stack(char **argv, int argc, int i);
int is_sorted(t_stack *lst);
int stack_len(t_stack *lst);
void sort_three(t_stack **lst);
void sort(t_stack **a, t_stack **b);
void swap(t_stack **ptr);
void rot(t_stack **ptr);
void rotr(t_stack **ptr);
void sa(t_stack **ptr);
void sb(t_stack **ptr);
void ss(t_stack **a, t_stack**b);
void ra(t_stack **ptr);
void rb(t_stack **ptr);
void rr(t_stack **a, t_stack**b);
void rrr(t_stack **a, t_stack**b);
void rra(t_stack **ptr);
void rrb(t_stack **ptr);
void pb(t_stack **a, t_stack **b);
void pa(t_stack **a, t_stack **b);
void upd_idx_medium(t_stack *lst);
void upd_target_ab(t_stack *a, t_stack *b);
void upd_cost_ab(t_stack *a, t_stack *b);
void upd_cheapest(t_stack *a);
void upd_target_ba(t_stack *a, t_stack *b);
void from_a_to_b(t_stack **a, t_stack **b);
void from_b_to_a(t_stack **a, t_stack **b);
t_stack *max(t_stack *lst);
t_stack *min(t_stack *lst);
void reorder_a(t_stack **a);
#endif