sort5 not working
This commit is contained in:
parent
bf0aa15453
commit
327f5a296d
6
Makefile
6
Makefile
@ -6,7 +6,7 @@
|
||||
# By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ #
|
||||
# +#+ +#+#+ +#++#+ +#+ \o/ #
|
||||
# Created: 2024/10/15 11:48:46 by whaffman #+#+# #+#+# #+# #+# | #
|
||||
# Updated: 2024/11/07 12:48:24 by whaffman ### ### ### ### / \ #
|
||||
# Updated: 2024/11/07 15:28:08 by whaffman ### ### ### ### / \ #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -21,7 +21,7 @@ OBJ_PATH = obj
|
||||
VPATH = src:src/util:src/moves:src/sort
|
||||
|
||||
SOURCES = push_swap.c ft_lstat.c new_element.c push.c rotate.c reverse_rotate.c \
|
||||
swap.c sort3.c
|
||||
swap.c sort3.c sort5.c stack_min.c stack_max.c
|
||||
|
||||
OBJECTS = $(addprefix $(OBJ_PATH)/, $(SOURCES:.c=.o))
|
||||
|
||||
@ -63,7 +63,7 @@ fclean: clean
|
||||
re: fclean all
|
||||
|
||||
run: all
|
||||
@$(eval ARG = $(shell shuf -i 0-100 -n 3))
|
||||
@$(eval ARG = $(shell shuf -i 0-100 -n 5))
|
||||
./$(NAME) $(ARG)
|
||||
|
||||
debug: CFLAGS += -DDEBUG -g
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
|
||||
/* +#+ +#+#+ +#++#+ +#+ \o/ */
|
||||
/* Created: 2024/11/04 13:58:35 by whaffman #+#+# #+#+# #+# #+# | */
|
||||
/* Updated: 2024/11/07 13:12:32 by whaffman ### ### ### ### / \ */
|
||||
/* Updated: 2024/11/07 16:37:19 by whaffman ### ### ### ### / \ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -24,9 +24,12 @@ typedef struct s_state
|
||||
int new_element(t_list **stack, const char *str);
|
||||
t_list *ft_lstat(t_list *list, int n);
|
||||
void print_stack(const char *name, t_list *stack);
|
||||
void print_stacks(t_list *stack_a, t_list *stack_b);
|
||||
void print_state(t_state *state);
|
||||
int stack_max(t_list *lst);
|
||||
int stack_min(t_list *lst);
|
||||
|
||||
int sort3(t_state *state);
|
||||
int sort5(t_state *state);
|
||||
|
||||
void push(t_list **stack_1, t_list **stack_2);
|
||||
void rotate(t_list **stack);
|
||||
|
||||
@ -6,20 +6,20 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
|
||||
/* +#+ +#+#+ +#++#+ +#+ \o/ */
|
||||
/* Created: 2024/11/06 19:27:09 by whaffman #+#+# #+#+# #+# #+# | */
|
||||
/* Updated: 2024/11/06 19:38:01 by whaffman ### ### ### ### / \ */
|
||||
/* Updated: 2024/11/07 15:51:16 by whaffman ### ### ### ### / \ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include "push_swap.h"
|
||||
|
||||
void pa(t_state *state)
|
||||
void pb(t_state *state)
|
||||
{
|
||||
push(&(state->a), &(state->b));
|
||||
ft_printf("pa\n");
|
||||
}
|
||||
|
||||
void pb(t_state *state)
|
||||
void pa(t_state *state)
|
||||
{
|
||||
push(&(state->b), &(state->a));
|
||||
ft_printf("pb\n");
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
|
||||
/* +#+ +#+#+ +#++#+ +#+ \o/ */
|
||||
/* Created: 2024/11/04 13:04:11 by whaffman #+#+# #+#+# #+# #+# | */
|
||||
/* Updated: 2024/11/07 13:44:28 by whaffman ### ### ### ### / \ */
|
||||
/* Updated: 2024/11/07 15:26:58 by whaffman ### ### ### ### / \ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -70,7 +70,9 @@ int main(int argc, char *argv[])
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
sort3(state);
|
||||
ft_printf("min: %d\n", stack_min(state->a));
|
||||
ft_printf("max: %d\n", stack_max(state->a));
|
||||
sort5(state);
|
||||
print_state(state);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user