-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_print_lem.c
105 lines (95 loc) · 2.5 KB
/
debug_print_lem.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* debug_print_lem.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mle-roy <mle-roy@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/03/05 14:39:05 by mle-roy #+# #+# */
/* Updated: 2014/03/06 18:27:36 by mle-roy ### ########.fr */
/* */
/* ************************************************************************** */
#include "lemmin.h"
#include "libft.h"
#include <stdio.h> //nononononon
void debug_treat_maze(t_env *maze, int i)
{
printf("\n****************\n\nTOUR[%d]\n", i);
print_maze(maze);
}
void debug_solution(t_res *res, t_env *maze)
{
t_room *soluce;
int i = 1;
soluce = res->path;
printf("\n*******\nSOLUTION\nFOURMIZ: %d\n********\n", maze->fourmiz);
while (soluce)
{
if (soluce->start == 1)
printf("START->>");
if (soluce->end == 1)
printf("END->>");
printf("ROOM[%d]: %s\n", i, soluce->name);
i++;
soluce = soluce->next;
}
}
void print_lex(t_lx *lex)
{
t_lex *browse;
browse = lex->start;
while (browse)
{
printf("LEX=%s\n", browse->str);
browse = browse->next;
}
}
void print_room(t_mz *room)
{
t_connex *tmp;
printf("name=%s\n", room->name);
printf("flag=%d\n", room->flag);
printf("start=%d\n", room->start);
printf("end=%d\n", room->end);
printf("path=%d\n", room->path);
tmp = room->list;
printf("CONNEX:\n");
while (tmp)
{
printf("connex to %s\n", tmp->name);
tmp = tmp->next;
}
}
void print_maze(t_env *maze)
{
t_mz *rooms;
t_ant *ants;
printf("******\nfourmiz=%d\n", maze->fourmiz);
printf("***\nstart=%s\n", maze->start);
if (maze->start_ptr)
{
printf("\nSTART-ROOM\n");
print_room(maze->start_ptr);
}
printf("***\nend=%s\n", maze->end);
if (maze->end_ptr)
{
printf("\nEND-ROOM\n");
print_room(maze->end_ptr);
}
rooms = maze->rooms;
printf("***\nROOMS=\n");
while (rooms)
{
printf("\n");
print_room(rooms);
rooms = rooms->next;
}
ants = maze->ants;
printf("***\nANTS=\n");
while (ants)
{
printf("NB=%d\nROOM=%s\n", ants->nb, ants->room);
ants = ants->next;
}
}