57 Player::Player(std::string name, std::string position,
int simulation_time) {
78 std::vector<std::string> tokens;
79 std::stringstream ss_name(name);
81 while (std::getline(ss_name, token,
' ')) {
82 tokens.push_back(token);
84 std::string team_t = tokens[1].substr(1, tokens[1].length() - 2);
92 if (tokens.size() > 3) {
98 std::stringstream ss_position(position);
99 while (std::getline(ss_position, token,
' ')) {
100 if (token.compare(
"k") == 0) {
102 }
else if (token.compare(
"t") == 0) {
105 tokens.push_back(token);
108 switch (tokens.size()) {
110 x = atof(tokens[0].c_str());
111 y = atof(tokens[1].c_str());
112 vx = atof(tokens[2].c_str());
113 vy = atof(tokens[3].c_str());
114 theta = atof(tokens[4].c_str());
118 x = atof(tokens[0].c_str());
119 y = atof(tokens[1].c_str());
120 vx = atof(tokens[2].c_str());
121 vy = atof(tokens[3].c_str());
122 theta = atof(tokens[4].c_str());
160 std::vector<std::string> tokens;
161 std::stringstream ss_name(name);
163 while (std::getline(ss_name, token,
' ')) {
164 tokens.push_back(token);
167 switch (tokens.size()) {
171 team_t = tokens[1].substr(1, tokens[1].length() - 2);
179 team_t = tokens[1].substr(1, tokens[1].length() - 2);
188 team_t = tokens[1].substr(1, tokens[1].length() - 2);
201 std::stringstream ss_position(position);
202 while (std::getline(ss_position, token,
' ')) {
203 if (token.compare(
"k") == 0) {
205 }
else if (token.compare(
"t") == 0) {
208 tokens.push_back(token);
211 switch (tokens.size()) {
271 }
else if (
theta <= -180.0) {
275 if (source_direction > 180.0) {
276 source_direction -= 360.0;
277 }
else if (source_direction <= 180.0) {
278 source_direction += 360.0;
280 double erx = cos(
Self::PI * source_direction / 180.0);
281 double ery = sin(
Self::PI * source_direction / 180.0);
284 double erxm = (180.0 * erx) / (
Self::PI * distance);
285 double erym = (180.0 * ery) / (
Self::PI * distance);
Player The Player lorem Ipsum
Position The Position lorem Ipsum
void boundTo(Player *player)
void pretendToBound(Player *player)
static Vector2D getVector2DWithXAndY(double dx, double dy)
double getBodyDirection()
double getPointingDirection()
static std::string TEAM_NAME
Player * getPretenderFront()
static Vector2D getEmptyVector()
void setPlayerId(int player_id)
std::vector< Player * > pretenders
double getHeadDirection()
static char AGENT_TYPE
p = Player, t = Trainer
Vector2D The Vector2D lorem Ipsum