-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush_swap.h
More file actions
80 lines (67 loc) · 2.45 KB
/
Copy pathpush_swap.h
File metadata and controls
80 lines (67 loc) · 2.45 KB
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
71
72
73
74
75
76
77
78
79
80
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apereira <apereira@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/24 08:48:33 by apereira #+# #+# */
/* Updated: 2023/02/20 11:44:10 by apereira ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
# include <stdlib.h>
# include "libft/libft.h"
# include "ft_printf/ft_printf.h"
typedef struct s_vars
{
int i;
int *tmp;
}t_vars;
typedef struct s_moves
{
int ra;
int rb;
int rr;
int rra;
int rrb;
int rrr;
}t_moves;
int nbr_is_valid(t_list *a, char *str, int nbr, int index);
void stack_a_init(char **argv, t_list **a, t_vars *var, int argc);
// Movement Functions
void sa(t_list **a, int flag);
void sb(t_list **b, int flag);
void ss(t_list **a, t_list **b);
void pa(t_list **a, t_list **b);
void pb(t_list **a, t_list **b);
void ra(t_list **a, int flag);
void rb(t_list **b, int flag);
void rr(t_list **a, t_list **b);
void rra(t_list **a, int flag);
void rrb(t_list **b, int flag);
void rrr(t_list **b, t_list **a);
// Utility Functions
void print_stacks(t_list *a, char c);
void vars_init(t_vars *vars);
void clear_stacks(t_list **a, t_list **b);
void go_back(t_list **a);
int are_already_in_order(t_list *a);
void moves_reset(t_moves *moves);
// Sorting Functions
void three_or_less(t_list **a);
// Hard coded five or less
void five_or_less(t_list **a, t_list **b);
void find_highest_numbers(t_list **a, t_list **b);
void push_highest_numbers(t_list **a, t_list **b, int bigpos);
// Over 5 numbers
void sort_big(t_list **a, t_list **b);
t_list *biggest(t_list *b);
int bigger(t_list *element, t_list *b);
t_list *smallest(t_list *b);
int smaller(t_list *element, t_list *b);
void fewer_moves_element(t_list *node,
t_list *first, t_moves *moves, int sizea);
void first_element(t_list *node, t_list *first, t_moves *moves, int sizea);
#endif