/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* push_swap.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/07/31 16:56:54 by fgras-ca #+# #+# */ /* Updated: 2023/08/08 17:58:19 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef PUSH_SWAP_H # define PUSH_SWAP_H # include # include # include # include # include typedef struct s_stack { int value; int index; int pos; int target_pos; int cost_a; int cost_b; struct s_stack *next; } t_stack; t_stack *fill_stack_values(int argc, char **argv, int start_idx); void assign_index(t_stack *stack_a, int argc); int is_sorted(t_stack *stack); void tiny_sort(t_stack **stack); void sort(t_stack **stack_a, t_stack **stack_b); int get_lowest_index_position(t_stack **stack); void get_target_position(t_stack **stack_a, t_stack **b); void get_cost(t_stack **stack_a, t_stack **stack_b); void do_cheapest_move(t_stack **stack_a, t_stack **stack_b); void do_move(t_stack **a, t_stack **b, int cost_a, int cost_b); void do_pa(t_stack **stack_a, t_stack **stack_b); void do_pb(t_stack **stack_a, t_stack **stack_b); void do_sa(t_stack **stack_a); void do_sb(t_stack **stack_b); void do_ss(t_stack **stack_a, t_stack **stack_b); void do_ra(t_stack **stack_a); void do_rb(t_stack **stack_b); void do_rr(t_stack **stack_a, t_stack **stack_b); void do_rra(t_stack **stack_a); void do_rrb(t_stack **stack_b); void do_rrr(t_stack **stack_a, t_stack **stack_b); t_stack *get_stack_bottom(t_stack *stack); t_stack *get_stack_before_bottom(t_stack *stack); t_stack *stack_new(int value); void stack_add_bottom(t_stack **stack, t_stack *new); int get_stack_size(t_stack *stack); void free_stack(t_stack **stack); long int ft_atoi(const char *str); void ft_putstr(char *str); int nb_abs(int nb); void exit_error(t_stack **stack_a, t_stack **stack_b); int is_correct_input(char **argv, int start_idx); int is_digit(char c); int is_sign(char c); int nbstr_cmp(const char *s1, const char *s2); int size_numbers(char **numbers); char **ft_split(char const *s, char c); char **split_args(char *arg); #endif