-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput_commands.cpp
More file actions
147 lines (108 loc) · 5.03 KB
/
output_commands.cpp
File metadata and controls
147 lines (108 loc) · 5.03 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// #include "Food.h"
// #include "creature.h"
void food_data_full(queue<Food *> food_list) {
if (food_list.size() == 0) {
cout << "\n\nNO FOOD REMAINS...\n";
}
for (int i = 0; i< food_list.size(); i++) {
// Food *fptr = food_list.front();
Food *f = food_list.front();
cout << "\n\nFOOD " << i << " INFO: \n";
cout << "X: " << f->x << " Y: " << f->y << "\n";
cout << "Size : " << f->size << " || Min_Size: " << f->min_size << "\n";
cout << "Size Given: " << f->nibble_size << " || Energy Returned: " << f->energy_returned_percentage << "\n";
cout << "nutrients_left: " << f->nutrients_left << "\n";
food_list.pop();
food_list.push(f);
}
}
void food_data_condensed(queue<Food *> food_list) {
if (food_list.size() == 0) {
cout << "\n\nNO FOOD REMAINS...\n";
}
for (int i = 0; i< food_list.size(); i++) {
// Food *fptr = food_list.front();
Food *f = food_list.front();
cout << "F @(" << f->x << ", " << f->y << ") n: "<< f->nutrients_left << " | s: "<< f->size << "";
food_list.pop();
food_list.push(f);
}
}
void animal_data_full(queue<Creature> creature_list) {
if (creature_list.size() == 0) {
cout << "\n\nNO CREATURE REMAINS...\n";
}
for (int i = 1; i<= creature_list.size(); i++) {
Creature c = creature_list.front();
// Food targ = c.get_target();
cout << "\n\nCREATURE " << i << " INFO: \n";
cout << "X: " << c.x << " Y: " << c.y << "\n";
cout << "Size: " << c.size << " || Splitting Factor: " << c.splitting_factor << "\n";
cout << "Generation: " << c.generation << "\n";
cout << "Current Energy: " << c.cur_energy << " || Max Energy " << c.max_energy << " || Speed " << c.speed << "\n";
cout << "DistDiag @ " << c.distdiag << ", {distx: " << c.distx << ", disty: " << c.disty << "}\n";
cout << "Hunting food pointer @ " << c.target->x<< ", " << c.target->y << "(" <<c.target->nutrients_left << " remaining) \n";
creature_list.pop();
creature_list.push(c);
}
}
void animal_data_condensed(queue<Creature> creature_list) {
if (creature_list.size() == 0) {
cout << "\n\nNO CREATURE REMAINS...\n";
}
for (int i = 1; i<= creature_list.size(); i++) {
Creature c = creature_list.front();
cout << "C" << i << " @(" << c.x << ", " << c.y << ") \tsplt: "<< c.splitting_factor << " \t| size: "<< c.size << " \t| spd: "<< c.speed << " \t| gen: "<< c.generation << "\n";
creature_list.pop();
creature_list.push(c);
}
}
void get_all_averages(queue<Creature> *creature_list_pointer){
double average_gen = 0;
double lowest_gen = 1000000;
double highest_gen = -1;
double average_speed = 0;
double lowest_speed = 1000000;
double highest_speed = -1;
double average_size = 0;
double lowest_size = 1000000;
double highest_size = -1;
double average_splitting_factor = 0;
double lowest_splitting_factor = 1000000;
double highest_spltting_factor = -1;
if (creature_list_pointer->size() == 0) {
cout << "\n\nNO CREATURE REMAINS...\n";
}
queue<Creature> creature_list = *creature_list_pointer;
for (int i = 1; i<= creature_list.size(); i++) {
Creature c = creature_list.front();
double speed = c.speed;
double size = c.size;
double splitting_factor = c.splitting_factor;
double gen = c.generation;
lowest_gen = std::min(lowest_gen, gen);
lowest_size = std::min(lowest_size, size);
lowest_splitting_factor = std::min(lowest_splitting_factor, splitting_factor);
lowest_speed = std::min(lowest_speed, speed);
highest_gen = std::max(highest_gen, gen);
highest_size = std::max(highest_size, size);
highest_spltting_factor = std::max(highest_spltting_factor, splitting_factor);
highest_speed = std::max(highest_speed, speed);
average_size = average_size + size;
average_gen = average_gen + gen;
average_speed = average_speed + speed;
average_splitting_factor = average_splitting_factor + splitting_factor;
creature_list.pop();
creature_list.push(c);
}
average_size = average_size/ creature_list.size();
average_gen = average_gen/ creature_list.size();
average_speed = average_speed/ creature_list.size();
average_splitting_factor = average_splitting_factor/ creature_list.size();
cout << "************************************************************\n";
cout << "\t\tLow\t\tAverage\t\tHigh\n";
cout << "Speed:\t\t" << lowest_speed << "\t" << average_speed << "\t\t" << highest_speed << "\n";
cout << "Generation:\t" << lowest_gen << "\t\t" << average_gen << "\t\t" << highest_gen << "\n";
cout << "Size:\t\t" << lowest_size << "\t\t" << average_size << "\t\t" << highest_size << "\n";
cout << "Split Fact:\t" << lowest_splitting_factor << "\t\t" << average_splitting_factor << "\t\t" << highest_spltting_factor << "\n";
}