1
0

first commit

This commit is contained in:
Adam Joly
2023-08-03 23:16:27 +02:00
parent 7f3254f1c5
commit a80c4d61d7
133 changed files with 4293 additions and 0 deletions

55
BSQ/srcs/algo/algo.c Normal file
View File

@ -0,0 +1,55 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* algo.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/01 22:03:23 by axdubois #+# #+# */
/* Updated: 2023/08/02 20:32:48 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../includes/algo-h/algo.h"
#include "../../includes/utils-h/utils.h"
int ft_is_side_max(int x, int y, int mx, int my)
{
int l;
l = (mx - x) - (my - y);
if (l > 0)
return (mx - x);
else if (l < 0)
return (my - y);
else
return (0);
}
t_square ft_comb(t_coords *listobjsx, t_coords *listobjsy)
{
int i;
int j;
t_square square_max;
square_max.x = 0;
square_max.y = 0;
square_max.side = 0;
i = -1;
j = -1;
while (listobjsx[++i].x > -1)
{
while (listobjsy[++j].y > -1)
{
if ((square_max.x - listobjsx[i].x) < 0
&& (square_max.y - listobjsy[j].y) < 0)
{
square_max.x = listobjsx[i].x;
square_max.y = listobjsy[i].y;
square_max.side = ft_is_side_max(listobjsx[i].x,
listobjsy[j].y, square_max.x, square_max.y);
}
}
}
return (square_max);
}

BIN
BSQ/srcs/algo/algo.o Normal file

Binary file not shown.

View File

@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* controller.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/02 14:57:07 by axdubois #+# #+# */
/* Updated: 2023/08/02 20:39:52 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../includes/Display-h/write.h"
#include "../../includes/utils-h/utils.h"
#include "../../includes/algo-h/algo.h"
#include "../../includes/utils-h/charobj.h"
#include "../../includes/utils-h/fst_line.h"
int ft_controller(int file)
{
t_charobj charobj;
charobj = ft_get_charobj(ft_get_first_line(file), ft_len_line(file, 0));
ft_print_result(ft_comb(ft_sort_x(ft_get_list_obj(file, charobj.o),
ft_get_nobj(file, charobj.o)),
ft_sort_y(ft_get_list_obj(file, charobj.o),
ft_get_nobj(file, charobj.o))), charobj,
ft_get_list_obj(file, charobj.o),
file);
return (0);
}

BIN
BSQ/srcs/algo/controller.o Normal file

Binary file not shown.