-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHeader.h
More file actions
124 lines (92 loc) · 2.93 KB
/
Copy pathHeader.h
File metadata and controls
124 lines (92 loc) · 2.93 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <Windows.h>
#include <math.h>
#include <SFML/Graphics.h>
#define START_NUM_PREDS 200
#define START_NUM_PEACES 400
#define START_NUM_PLANKTON 500
#define MAX_NEED_TO_PAIRING_PREDS 10
#define MAX_NEED_TO_PAIRING_PEACE 13
#define MAX_PREDS_AGE 38
#define MAX_PEACE_AGE 15
#define MAX_PLANKTON_AGE 4
#define PLANKTON_SPEED 1
#define FISH_SPEED 2
#define ROW_NUM 90
#define COL_NUM 180
#define NUM_STEPS_FOR_PREDS 10
#define NUM_STEPS_FOR_PEACES 2
#define PLANKTON_NUM_CHILDS 1
#define PLANKTON_MAX_NUM_NEIGHBOUR_FOR_CHILDS 4
#define PLANKTON_MAX_NUM_NEIGHBOUR_FOR_GO 3
#define NUM_NEIGHBOUR 8
#define MAX_NUM_PREDS 5000
#define MAX_NUM_PEACES 5000
#define MAX_NUM_PLANKTON 4000
#define MIN_HEALTH_FOR_PAIRING 80
#define DELTA_OF_FOOD
#define PARTS 9
enum Sex {
MALE,
FEMALE
};
enum Priority {
PAIRING,
EATING
};
enum TypeOfFish {
PEACE,
PREDATOR
};
typedef struct Plankton {
int timeOfLife;
int age;
int speed;
int x, y;
}PLANKTON;
typedef struct Fish {
enum Sex sex;
enum Priority priority;
enum TypeOfFish typeOfFish;
int timeOfLife;
int needToPairing;
int deltaWithoutFood;
int DeltaWithFood;
int deltaToPairing;
int x, y;
int curSpeed;
int curToPairing;
int age;
int health;
}FISH;
typedef struct Enemy {
FISH* fish;
PLANKTON* plank;
}ENEMY;
void ModelOcean();
sfSprite* CreateSprite(const char* textureFileName);
void DrawCreatures(sfRenderWindow* window, sfSprite* peaceSprite, sfSprite* predSprite, sfSprite* plankSprite, int col, int row, ENEMY** ocean);
void Start(ENEMY** ocean, int row, int col, int windowSize);
void SpawnEnemy(const char* typeOfMem, ENEMY** ocean, int row, int col);
ENEMY CreateFish(enum TypeOfFish type, int row, int col);
ENEMY CreatePredator(enum TypeOfFish type, int row, int col);
ENEMY CreatePeace(enum TypeOfFish type, int row, int col);
ENEMY CreateFishChild(enum TypeOfFish type, int x, int y);
ENEMY** InitAqua(int row, int col);
ENEMY CreatePlankton(int row, int col);
void LetsGo(ENEMY** ocean, int row, int col, int x, int y);
int FormulaForIndexes(int min, int max, int delta, int n);
void IncreaseNumPlankton(ENEMY** ocean, int row, int col, int x, int y);
ENEMY SpawnPlanktonChild(int x, int y);
int NumFreeAround(ENEMY** ocean, int row, int col, int x, int y, int speed, int** water_around, char** option);
int CountFree(ENEMY** ocean, int row, int col, int x, int y, int speed, int** water_around);
void NumAround(ENEMY** ocean, int row, int col, int x, int y, int** food_around, int* num_of_food, int* num_of_partnersM, int* num_of_partnersF, int* num_of_water);
void EatAndSex(ENEMY** ocean, int row, int col, int x, int y, int numOfGuys);
void ItsTimeToDie(ENEMY** ocean, int x, int y);
void PairForFish(ENEMY** ocean, enum TypeOfFish type, int** obj_around, int* visited, int x, int y, int num_of_partners, int* isPared, int sexID);