-
Notifications
You must be signed in to change notification settings - Fork 0
/
map5.c
75 lines (68 loc) · 1.61 KB
/
map5.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* map5.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fvon-nag <fvon-nag@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/24 08:15:05 by fvon-nag #+# #+# */
/* Updated: 2023/02/24 08:18:04 by fvon-nag ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
int rectch2(t_matrix **mapgr, int xmax, int ymax)
{
int i;
i = 0;
while (i < xmax)
{
if (mapgr[i][ymax - 1].c != '1')
return (1);
i++;
}
i = 0;
while (i < ymax)
{
if (mapgr[xmax - 1][i].c != '1')
return (1);
i++;
}
i = 0;
return (0);
}
int rectch1(t_matrix **mapgr, int xmax, int ymax)
{
int i;
i = 0;
while (i < xmax)
{
if (mapgr[i][0].c != '1')
return (1);
i++;
}
i = 0;
while (i < ymax)
{
if (mapgr[0][i].c != '1')
return (1);
i++;
}
i = 0;
if (rectch2(mapgr, xmax, ymax) == 1)
return (1);
return (0);
}
int ft_strlen_nnl(char *str)
{
int i;
int count;
i = 0;
count = 0;
while (str[i])
{
if (str[i] != '\n' || str[i] != '0')
count++;
i++;
}
return (count);
}