Skip to content

Commit

Permalink
comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
SaladBunda committed Apr 17, 2024
1 parent a3a7e40 commit f73aaf8
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions Push-Swap-Tester
Submodule Push-Swap-Tester added at 2c5958
Binary file removed bonus/a.out
Binary file not shown.
4 changes: 2 additions & 2 deletions bonus/checker_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ael-maaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/09 02:48:47 by ael-maaz #+# #+# */
/* Updated: 2024/04/09 02:49:29 by ael-maaz ### ########.fr */
/* Updated: 2024/04/14 22:47:27 by ael-maaz ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -55,7 +55,7 @@ int read_input(t_stack *a, t_stack *b)
if (line[0] == '\0')
break ;
if (test_line(line, a, b) == -1)
return (-1);
return (free(line),-1);
free(line);
}
if (error == -1)
Expand Down
8 changes: 4 additions & 4 deletions bonus/main_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ael-maaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/01 16:58:38 by ael-maaz #+# #+# */
/* Updated: 2024/04/09 02:49:20 by ael-maaz ### ########.fr */
/* Updated: 2024/04/14 22:47:53 by ael-maaz ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -102,11 +102,11 @@ int main(int ac, char **av)
return (write(2, "Error\n", 6), 0);
bubble_sort(&a);
if (read_input(&a, &b) == -1)
return (write(2, "Error\n", 6), 0);
return (system("leaks checker"),write(2, "Error\n", 6), 0);
if (is_sorted(&a) == 0 && b.top == -1)
return (write(1, "OK\n", 3), 0);
return (system("leaks checker"),write(1, "OK\n", 3), 0);
else
return (write(1, "KO\n", 3), 0);
return (system("leaks checker"),write(1, "KO\n", 3), 0);
free(a.stack);
free(b.stack);
}
Expand Down
3 changes: 0 additions & 3 deletions bonus/test.txt

This file was deleted.

Binary file removed bonus/test_bonus.o
Binary file not shown.
4 changes: 2 additions & 2 deletions bonus/util_func2_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ael-maaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/04 22:26:52 by ael-maaz #+# #+# */
/* Updated: 2024/04/09 01:40:31 by ael-maaz ### ########.fr */
/* Updated: 2024/04/14 22:34:12 by ael-maaz ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -46,7 +46,7 @@ int get_range(int size)
{
int range;

range = 0.045 * size + 10.5;
range = -0.0000233333 * size * size + 0.059 * size + 9.3333;
return (range);
}

Expand Down
Binary file modified push_swap
Binary file not shown.
8 changes: 4 additions & 4 deletions srcs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ael-maaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/01 16:58:38 by ael-maaz #+# #+# */
/* Updated: 2024/04/08 18:37:13 by ael-maaz ### ########.fr */
/* Updated: 2024/04/17 16:54:14 by ael-maaz ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -28,6 +28,8 @@ int fill_stack(char **av, int ac, t_stack *stack_a, int i)
if (av[i][0] == 0)
error = 1;
arg = ft_split(av[i], ' ');
// if(!arg[0])
// error = 1;
while (arg[++j])
{
stack_a->top++;
Expand All @@ -36,9 +38,7 @@ int fill_stack(char **av, int ac, t_stack *stack_a, int i)
}
free(arg);
}
if (error == 0)
return (0);
return (1);
return (error);
}

int duplicates(t_stack stack_a)
Expand Down
Binary file modified srcs/main.o
Binary file not shown.
5 changes: 1 addition & 4 deletions srcs/push_swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@
/* By: ael-maaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/01 16:59:48 by ael-maaz #+# #+# */
/* Updated: 2024/04/07 22:15:42 by ael-maaz ### ########.fr */
/* Updated: 2024/04/12 20:45:27 by ael-maaz ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H

# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
# include <limits.h>
# include <fcntl.h>

typedef struct s_stack
{
Expand Down
7 changes: 5 additions & 2 deletions srcs/util_func2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ael-maaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/04 22:26:52 by ael-maaz #+# #+# */
/* Updated: 2024/04/07 22:48:36 by ael-maaz ### ########.fr */
/* Updated: 2024/04/14 22:33:53 by ael-maaz ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -44,7 +44,10 @@ int get_range(int size)
{
int range;

range = 0.045 * size + 10.5;
// range = 0.000000053 * size * size + 0.03 * size + 14.5;
// range = (-0.0000089) * size * size + 0.04277614 * size + 10.81125433;
range = -0.0000233333 * size * size + 0.059 * size + 9.3333;
// range = 0.00005472*size*size+0.07429589*size+7.0972073;
return (range);
}

Expand Down
Binary file modified srcs/util_func2.o
Binary file not shown.

0 comments on commit f73aaf8

Please sign in to comment.