-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_lemin_2.c
83 lines (72 loc) · 999 Bytes
/
print_lemin_2.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
76
77
78
79
80
81
82
83
#include "lem_in.h"
void check_ant_in_end(t_route **route, t_lemin **lemin)
{
t_route *r;
char *end;
end = is_end(lemin);
r = (*route);
while (r->next)
{
if (!ft_strcmp(r->room, end))
{
r->ant = 0;
return ;
}
r = r->next;
}
}
int routes_is_ampty(t_routes **routes)
{
t_routes *rs;
t_route *r;
rs = (*routes);
while (rs)
{
r = rs->route;
while (r->next->room)
{
if (r->ant)
return (1);
r = r->next;
}
rs = rs->next;
}
return (0);
}
int route_is_ampty(t_route *route)
{
t_route *r;
r = route;
while (r->next->room)
{
if (r->ant)
return (1);
r = r->next;
}
return (0);
}
void end(t_route **room, t_lemin **lemin)
{
char *end;
if ((*room)->room)
{
end = is_end(lemin);
if (!ft_strcmp((*room)->room, end))
{
(*room)->ant = 0;
(*room)->move = 0;
}
}
return ;
}
void print_stdin(t_lemin **lemin)
{
char **str;
str = (*lemin)->std_in;
while (*str)
{
ft_printf("%s\n", *str);
str++;
}
ft_printf("\n");
}