-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecosys.h
45 lines (34 loc) · 1.36 KB
/
ecosys.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
#ifndef _ECOSYS_H_
#define _ECOSYS_H_
#define SIZE_X 20
#define SIZE_Y 50
typedef struct _animal {
int x;
int y;
int dir[2]; /* direction courante sous la forme (dx, dy) */
float energie;
struct _animal *suivant;
} Animal;
extern float p_ch_dir;
extern float p_reproduce_proie;
extern float p_reproduce_predateur;
extern int temps_repousse_herbe;
Animal *creer_animal(int x, int y, float energie);
Animal *ajouter_en_tete_animal(Animal *liste, Animal *animal);
unsigned int compte_animal_rec(Animal *la);
unsigned int compte_animal_it(Animal *la);
void ajouter_animal(int x, int y, float energie, Animal **liste_animal);
void enlever_animal(Animal **liste, Animal *animal);
Animal* liberer_liste_animaux(Animal *liste);
void afficher_ecosys(Animal *liste_predateur, Animal *liste_proie);
void ecrire_ecosys(const char* nom_fichier, Animal* liste_predateur, Animal* liste_proie);
void lire_ecosys(const char* nom_fichier, Animal** liste_proie, Animal** liste_predateur);
void bouger_animaux(Animal *la);
void reproduce(Animal **liste_animal, float p_reproduce);
Animal *animal_en_XY(Animal *l, int x, int y);
void rafraichir_predateurs(Animal **liste_predateur, Animal **liste_proie);
void rafraichir_proies(Animal **liste_proie, int monde[SIZE_X][SIZE_Y]) ;
void rafraichir_monde(int monde[SIZE_X][SIZE_Y]);
void afficher_animal(Animal* ani);
void clear_screen();
#endif