-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·68 lines (62 loc) · 1.57 KB
/
main.cpp
File metadata and controls
executable file
·68 lines (62 loc) · 1.57 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
#include "Bacteria.h"
void prompt()
{
string input;
cin >> input;
if (!cin)
return;
}
int main()
{
srand(time(NULL)); // set seed for RNG()
Bacteria b(1, 2, 1, false);
// Animal::print();
// cout << endl << endl;
// Animal::charVec[b.getY() - 1][b.getX() - 1] = '.';
// b.setXY(2, 3);
// int y = 2;
// int x = 1;
// while (x < 5)
// {
// Bacteria c(x, y, 1, false);
// ++x;
// }
// while (y < 6)
// {
// Bacteria c(x, y, 1, false);
// ++y;
// }
// while (x > 0)
// {
// Bacteria c(x, y, 1, false);
// --x;
// }
// Animal::print();
map<int,Bacteria> bacMapCopy = Bacteria::bacMap;
map<int, Bacteria>::iterator bacIter;
while (true)
{
prompt();
bacMapCopy = Bacteria::bacMap;
bacIter = bacMapCopy.begin();
cout << "Start reproducing\n";
while(bacIter != bacMapCopy.end())
{
bacIter->second.reproduce();
++bacIter;
}
Animal::print();
cout << "Start moving\n";
bacMapCopy = Bacteria::bacMap;
bacIter = bacMapCopy.begin();
while(bacIter != bacMapCopy.end())
{
bacIter->second.move();
++bacIter;
}
cout << "Elements in bacMap: " << Bacteria::bacMap.size() << endl;
Animal::print();
}
// NOTE NOTE NOTE You need to be changing FIRST in every pair as you iterate.
return 0;
}