60 lines
1.6 KiB
C
60 lines
1.6 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* check.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/07/24 08:21:31 by cchauvet #+# #+# */
|
|
/* Updated: 2022/07/24 20:18:19 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <stdlib.h>
|
|
|
|
int ft_verif_line(int nb_tower_viewable_in, int *line, int size)
|
|
{
|
|
int i;
|
|
int j;
|
|
int nb_tower_viewable_out;
|
|
|
|
i = 0;
|
|
j = 0;
|
|
nb_tower_viewable_out = 1;
|
|
while (i < size)
|
|
{
|
|
j = 0;
|
|
while (line[j] < line[i])
|
|
{
|
|
if (i == j + 1)
|
|
break ;
|
|
j++;
|
|
}
|
|
if (line[j] < line[i])
|
|
nb_tower_viewable_out++;
|
|
i++;
|
|
}
|
|
return (nb_tower_viewable_out);// == nb_tower_viewable_in);
|
|
}
|
|
|
|
|
|
int *ft_verif(int *tab_user, int *tab_gen, int size)
|
|
{
|
|
int i;
|
|
int j;
|
|
int *line;
|
|
|
|
i = 0;
|
|
line = malloc(sizeof(*line) * size);
|
|
while (i < size * 4)
|
|
{
|
|
j = 0;
|
|
while (j < size * size)
|
|
{
|
|
ft_verif_line(tab_user[i], line, size);
|
|
j++;
|
|
}
|
|
i++;
|
|
}
|
|
}
|