-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwolf.cpp
More file actions
34 lines (29 loc) · 1.02 KB
/
wolf.cpp
File metadata and controls
34 lines (29 loc) · 1.02 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
#include "wolf.h"
#include "case.h"
Wolf::Wolf(string side, Case &_case)
{
side_ = side;
strength_ = _case.strength_of_wolf_;
if (side_ == "red") {
index_ = _case.red_headquarter_.num_of_warriors_;
static_num_in_red_headquarter_++;
num_in_red_headquarter_ = static_num_in_red_headquarter_;
} else {
index_ = _case.blue_headquarter_.num_of_warriors_;
static_num_in_blue_headquarter_++;
num_in_blue_headquarter_ = static_num_in_blue_headquarter_;
}
}
void Wolf::printCondition() {
if (side_ == "red") {
cout << " red wolf " << index_ << " born with strength "
<< strength_ << ", " << num_in_red_headquarter_
<< " wolf in red headquater" << endl;
} else {
cout << " blue wolf " << index_ << " born with strength "
<< strength_ << ", " << num_in_blue_headquarter_
<< " wolf in blue headquater" << endl;
}
}
int Wolf::static_num_in_red_headquarter_ = 0;
int Wolf::static_num_in_blue_headquarter_ = 0;