-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac.cpp
154 lines (134 loc) · 4.33 KB
/
mac.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
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
148
149
150
151
152
153
154
//
// Created by netadim on 23.12.2021.
//
#include "mac.h"
#include <random>
#include <string>
#include "iostream"
using namespace std;
Mac::Mac(Takim& evSahibiTakim,Takim& rakipTakim,
int evSahibininSkoru,int rakibinSkoru,int macinID)
: evSahibi(evSahibiTakim), rakip(rakipTakim),macID(macinID)
//evSahibi(evSahibiTakým),rakip(rakipTakým)
{
setEvSahibiSkor(evSahibininSkoru);
setRakipSkor(rakibinSkoru);
setskorHesaplama();
}
void Mac::setEvSahibi(Takim& evSahibi){
this->evSahibi = evSahibi;
}
void Mac::setRakip(Takim& rakip){
this->rakip = rakip;
}
void Mac::setEvSahibiSkor(int a){
if(a<0){
evSahibiSkor=0;
}else{
evSahibiSkor= a;
}
}
void Mac::setRakipSkor(int a){
if(a<0){
rakipSkor=0;
}else{
rakipSkor= a;
}
}
void Mac::setskorHesaplama() {
// Defans Average
if (this->getEvSahibi().getPerformanceAvgD() > this->getRakip().getPerformanceAvgD()) {
this->setRakipSkor(this->getRakipSkor() - 1);
} else {
this->setEvSahibiSkor(this->getEvSahibiSkor() - 1);
}
// Orta Saha Average
if (this->getEvSahibi().getPerformanceAvgO() > this->getRakip().getPerformanceAvgO()) {
this->setEvSahibiSkor(this->getEvSahibiSkor() + 1);
this->setRakipSkor(this->getRakipSkor() - 1);
} else {
this->setEvSahibiSkor(this->getEvSahibiSkor() - 1);
this->setRakipSkor(this->getRakipSkor() + 1);
}
//Forvet Average
if (this->getEvSahibi().getPerformanceAvgF() > this->getRakip().getPerformanceAvgF()) {
this->setEvSahibiSkor(this->getEvSahibiSkor() + 1);
} else {
this->setRakipSkor(this->getRakipSkor() + 1);
}
// Toplam Average
if (this->getEvSahibi().getPerformanceAvgTeam() > this->getRakip().getPerformanceAvgTeam()) {
srand(time(NULL));
int durum1;
for (int x = 0; x < 1; x++) {
durum1 = rand() % 2;
}
if (durum1 == 0) {
this->setEvSahibiSkor(this->getEvSahibiSkor() + 1);
} else {
this->setRakipSkor(this->getRakipSkor() - 1);
}
} else {
srand(time(NULL));
int durum2;
for (int x = 0; x < 1; x++) {
durum2 = rand() % 2;
}
if (durum2 == 0) {
this->setRakipSkor(this->getRakipSkor() + 1);
} else {
this->setEvSahibiSkor(this->getEvSahibiSkor() - 1);
}
}
if(this->evSahibiSkor>this->rakipSkor){
int point = this->evSahibi.getLeaguePoint()+3;
int countWin = this->evSahibi.getCountWin()+1;
int countLose = this->rakip.getCountLose()+1;
int homeGoal = this->evSahibi.getCountGoal()+this->evSahibiSkor;
int guestGoal = this->rakip.getCountGoal()+this->rakipSkor;
this->evSahibi.setLeaguePoint(point);
this->evSahibi.setCountWin(countWin);
this->evSahibi.setCountGoal(homeGoal);
this->rakip.setCountLose(countLose);
this->rakip.setCountGoal(guestGoal);
}else if (this->getRakipSkor()>this->evSahibiSkor){
int point = this->rakip.getLeaguePoint()+3;
int countWin = this->rakip.getCountWin()+1;
int countLose = this->evSahibi.getCountLose()+1;
int homeGoal = this->evSahibi.getCountGoal()+this->evSahibiSkor;
int guestGoal = this->rakip.getCountGoal()+this->rakipSkor;
this->rakip.setLeaguePoint(point);
this->rakip.setCountWin(countWin);
this->evSahibi.setCountGoal(homeGoal);
this->evSahibi.setCountLose(countLose);
this->rakip.setCountGoal(guestGoal);
}else{
int point = this->rakip.getLeaguePoint()+1;
this->rakip.setLeaguePoint(point);
int point2 = this->evSahibi.getLeaguePoint()+1;
this->evSahibi.setLeaguePoint(point2);
int homeGoal = this->evSahibi.getCountGoal()+this->evSahibiSkor;
int guestGoal = this->rakip.getCountGoal()+this->rakipSkor;
this->rakip.setCountGoal(guestGoal);
this->evSahibi.setCountGoal(homeGoal);
}
std::cout<<this->evSahibi.getCountGoal()<<endl;
}
void Mac::setMacID(int macID){
this->macID = macID;
}
Takim Mac::getEvSahibi(){
return evSahibi;
}
Takim Mac::getRakip(){
return rakip;
}
int Mac::getEvSahibiSkor(){
return evSahibiSkor;
}
int Mac::getRakipSkor(){
return rakipSkor;
}
int Mac::getMacID(){
return macID;
}