-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodes.h
75 lines (65 loc) · 1.18 KB
/
nodes.h
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
/*
** nodes.h for lem_in in /home/franck_r/rendu/lemin
**
** Made by Romain Franck
** Login <franck_r@epitech.net>
**
** Started on Tue Mar 25 11:09:02 2014 Romain Franck
** Last update Fri May 2 15:41:52 2014 root
*/
#ifndef NODES_H_
# define NODES_H_
# define MIN(x, y) (x < y ? x == -1 ? y : x : y == -1 ? x : y)
# define WEIGHT(x, y) (x < y ? x == 0 ? y : x : y == 0 ? x : y)
#define NODE(x) (x->weight == 0 ? 0 : x->weight + x->full)
typedef struct s_node
{
struct s_node *prev;
char *name;
int weight;
int nb_link;
int full;
struct s_node **links;
struct s_node *next;
} t_nd;
typedef struct s_farm_sen
{
t_nd *start;
t_nd *exit;
t_nd *first;
t_nd *last;
unsigned size;
int ants;
} t_frm;
typedef struct s_ant
{
int number;
t_nd *node;
struct s_ant *next;
} t_ant;
typedef struct s_path
{
struct s_path *prev;
t_nd *node;
struct s_path *next;
} t_pth;
typedef struct s_psen
{
t_pth *first;
t_pth *last;
} t_pn;
typedef struct s_lnkstr
{
struct s_lnkstr *prev;
struct s_lnkstr *next;
char *link;
char *first;
char *second;
} t_lnk;
typedef struct s_lnksen
{
t_lnk *first;
t_lnk *last;
int size;
} t_sln;
#endif