42/push_swap.git
21 months agoChange return type of stack_push from void
Lukas Jiriste [Thu, 29 Feb 2024 09:29:12 +0000 (10:29 +0100)]
Change return type of stack_push from void

Previously the return type was void as handling any error was percieved
as too annoying and action_push must have been void anyway.
This change is done for future changes that may benefit from the
information of error, while the return value is ignored in the
functions that expect void.

21 months agoRefactor push.c so as to conform with the Norm
Lukas Jiriste [Sat, 24 Feb 2024 13:13:56 +0000 (14:13 +0100)]
Refactor push.c so as to conform with the Norm

21 months agoFix "off by one" errors, fix find_target_ind
Lukas Jiriste [Sat, 24 Feb 2024 10:18:02 +0000 (11:18 +0100)]
Fix "off by one" errors, fix find_target_ind

The function find_target_ind used (malfunctioning) binary search,
but that proved to be more difficult so I reimplemented it using
basic linear search.

21 months agoUse newline as an output separator instead of space
Lukas Jiriste [Fri, 23 Feb 2024 11:25:52 +0000 (12:25 +0100)]
Use newline as an output separator instead of space

21 months agoWeaken the 3 or less sort and fix binary search
Lukas Jiriste [Fri, 23 Feb 2024 11:13:25 +0000 (12:13 +0100)]
Weaken the 3 or less sort and fix binary search

The a_sort_three_or_less function needs not to rotate,
as the a stack will be rotated many times during the insertion.

21 months agoFix is_sorted so it does not change its argument.
Lukas Jiriste [Fri, 23 Feb 2024 09:59:51 +0000 (10:59 +0100)]
Fix is_sorted so it does not change its argument.

21 months agoImplement a sorting algorithm
Lukas Jiriste [Fri, 23 Feb 2024 09:36:57 +0000 (10:36 +0100)]
Implement a sorting algorithm

The idea is to push everything except for 3 elements from a to b.
Stack a can then be trivially sorted after which we can insert
(the cheapest) elements from b to the correct place in a.

The implementation needs to be refined as it does not actually sort.

21 months agoUpdate Libft to gain access to ft_max and ft_min
Lukas Jiriste [Fri, 23 Feb 2024 09:36:20 +0000 (10:36 +0100)]
Update Libft to gain access to ft_max and ft_min

21 months agoRefactor stack functions from checker.c
Lukas Jiriste [Tue, 6 Feb 2024 13:55:32 +0000 (14:55 +0100)]
Refactor stack functions from checker.c

21 months agoRefactor dir structure and prog argument parsing
Lukas Jiriste [Tue, 6 Feb 2024 12:23:16 +0000 (13:23 +0100)]
Refactor dir structure and prog argument parsing

22 months agoStart the project, implement checker
Lukas Jiriste [Wed, 24 Jan 2024 13:44:15 +0000 (14:44 +0100)]
Start the project, implement checker