forked from SharifAIChallenge/AIC17-Client-Cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstants.cpp
More file actions
133 lines (107 loc) · 3.26 KB
/
Constants.cpp
File metadata and controls
133 lines (107 loc) · 3.26 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
/*
* Constants.cpp
*
* Created on: Feb 16, 2015
* Author: rmin
*/
#include "Constants.h"
#include "Food.h"
#include "Slippers.h"
#include "Trash.h"
const std::string Constants::MESSAGE_KEY_TYPE = "type";
const std::string Constants::MESSAGE_KEY_NAME = "name";
const std::string Constants::MESSAGE_KEY_ARGS = "args";
const std::string Constants::MESSAGE_KEY_TURN = "turn";
const std::string Constants::MESSAGE_KEY_INIT = "init";
const std::string Constants::MESSAGE_KEY_TOKEN = "token";
const std::string Constants::MESSAGE_KEY_EVENT = "event";
const std::string Constants::MESSAGE_KEY_WRONG_TOKEN = "wrong token";
const std::string Constants::MESSAGE_KEY_SHUTDOWN = "shutdown";
const std::string Constants::TYPE_CHANGE_STRATEGY = "s";
const std::string Constants::TYPE_DETERMINISTIC_MOVE = "m";
const std::string Constants::TYPE_ANTENNA_CHANGE = "c";
const int Constants::ARGS_NUMBER_CHANGE_STRATEGY = 5;
const int Constants::ARGS_NUMBER_DETERMINISTIC_MOVE = 2;
const int Constants::ARGS_NUMBER_ANTENNA_CHANGE = 1;
void Constants::setConstants(Json::Value &msg) {
this->foodProb = msg[1u].asDouble();
this->trashProb = msg[2u].asDouble();
this->slipperProb = msg[3u].asDouble();
this->slipperValidTime = msg[4u].asInt();
this->typeChangeCost = msg[5u].asInt();
this->sickCost = msg[6u].asInt();
this->updateCost = msg[7u].asInt();
this->detMoveCost = msg[8u].asInt();
this->killWingedScore = msg[9u].asInt();
this->killBothWingedScore = msg[10u].asInt();
this->killBeetleScore = msg[11u].asInt();
this->wingedCollisionScore = msg[12u].asInt();
this->beetleFoodScore = msg[13u].asInt();
this->wingedBeetleFoodScore = msg[14u].asInt();
this->sickLifeTime = msg[15u].asInt();
this->powerRatio = msg[16u].asDouble();
this->endRatio = msg[17u].asDouble();
this->disobeyConstant = msg[18u].asInt();
this->foodValidTime = msg[19u].asInt();
this->trashValidTime = msg[20u].asInt();
Food::validTime = this->foodValidTime;
Slippers::validTime = this->slipperValidTime;
Trash::validTime = this->trashValidTime;
}
double Constants::getFoodProb() const {
return foodProb;
}
double Constants::getTrashProb() const {
return trashProb;
}
double Constants::getSlipperProb() const {
return slipperProb;
}
int Constants::getTypeChangeCost() const {
return typeChangeCost;
}
int Constants::getSickCost() const {
return sickCost;
}
int Constants::getUpdateCost() const {
return updateCost;
}
int Constants::getDetMoveCost() const {
return detMoveCost;
}
int Constants::getKillWingedScore() const {
return killWingedScore;
}
int Constants::getKillBothWingedScore() const {
return killBothWingedScore;
}
int Constants::getKillBeetleScore() const {
return killBeetleScore;
}
int Constants::getBeetleFoodScore() const {
return beetleFoodScore;
}
int Constants::getWingedBeetleFoodScore() const {
return wingedBeetleFoodScore;
}
int Constants::getSickLifeTime() const {
return sickLifeTime;
}
double Constants::getPowerRatio() const {
return powerRatio;
}
double Constants::getEndRatio() const {
return endRatio;
}
int Constants::getDisobeyConstant() const {
return disobeyConstant;
}
int Constants::getFoodValidTime() const {
return foodValidTime;
}
int Constants::getTrashValidTime() const {
return trashValidTime;
}
int Constants::getSlipperValidTime() const {
return trashValidTime;
}