-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrganism.cpp
31 lines (25 loc) · 916 Bytes
/
Organism.cpp
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
#include "Organism.h"
#include <iostream>
bool Organism::IsStandingHere(const position& checkedPosition) const {
return organismPosition == checkedPosition;
}
void Organism::Draw() const {
std::cout << organismSymbol;
}
bool Organism::operator<(const Organism& otherOrganism) const {
bool result = this->initiative < otherOrganism.initiative;
if(this->initiative == otherOrganism.initiative)
result = this->roundsOld < otherOrganism.roundsOld;
return result;
}
void Organism::Move(const position newPosition) {
organismPrevPosition = organismPosition;
organismPosition = newPosition;
organismWorld->ReportAboutOrganismNewPosition(this);
}
void Organism::MoveBack() {
Organism::Move(organismPrevPosition);
}
void Organism::ReportAboutOrganismDeath(Organism* killer, Organism* deadOrganism) const {
organismWorld->ReportAboutOrganismDeath(killer, deadOrganism);
}