This repository was archived by the owner on Jun 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.cpp
More file actions
51 lines (46 loc) · 1.3 KB
/
game.cpp
File metadata and controls
51 lines (46 loc) · 1.3 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
/**
* game.cpp/h
* These files contain constants used for game behaviour and the Event class
*/
#include <string>
#include <sstream>
#include <iomanip>
#include "game.h"
#include "robot.h"
const int HIGH_POINTS = 5;
const int LOW_POINTS = 2;
const int CROSS_POINTS = 5;
const int BASE_POINTS = CROSS_POINTS*2;
using namespace std;
string Event::toString(){
stringstream s, msg;
// s.precision(3);
// Add time info
s << setw(5) << (int) time
// Add team number
<< setw(7) << r->team
// Add location
<< " @" << setw(3) << location->index
// Add space for message
<< ":\t" << left << setw(50);
// Create event description depending on tepy
switch(type){
case Type::SCORE_LOW:
msg << "Score ball in low goal for " << points << " points";
break;
case Type::SCORE_HIGH:
msg << "Score ball in high goal for " << points << " points";
break;
case Type::CROSS:
msg << "Cross defense for " << points << " points";
break;
case Type::INTAKE:
msg << "Intake ball";
break;
default:
msg << "Drive through node " << location->index;
}
// Add description to string
s << msg.str() << "\n";
return s.str();
}