7 using namespace __gnu_cxx;
9 Bot::Bot(string name, string type){
15 cout << "reg: " << _name << " " << _type << endl;
22 _name = value<string>(input);
23 cerr << "Got name: " << _name << endl;
27 _players[value<string>(input)].type = "robber";
29 _players[value<string>(input)].type = "cop-foot";
31 _players[value<string>(input)].type = "cop-foot";
33 _players[value<string>(input)].type = "cop-foot";
35 _players[value<string>(input)].type = "cop-foot";
37 cerr << "Got players, building graph." << endl;
44 if (input == "game-over")
47 _type = _players[_name].type;
48 _location = _players[_name].location;
59 ( nod: loc node-tag coordinate coordinate eol )*
62 ( edg: loc loc edge-type eol )*
65 void Bot::buildGraph(){
71 cerr << "Getting intersections" << endl;
76 istringstream node(input);
79 Intersection& inter = _intersections[input];
85 cerr << "Number of intersections: " << _intersections.size() << endl;
91 cerr << "Getting streets" << endl;
98 istringstream street(input);
106 _intersections[from].connections[to] = both;
107 Intersection& inter = _intersections[to];
108 if (inter.connections.find(from) == inter.connections.end())
109 inter.connections[from] = foot;
111 _intersections[from].connections[to] = car;
113 cerr << "Number of streets: " << streets << endl;
116 void Bot::updateWorld(){
119 _world = value<int>(input);
120 cerr << "World: " << _world << endl;
123 _robbed = value<int>(input);
124 cerr << "Robbed: " << _robbed << endl;
131 istringstream bank(input);
134 bank >> _banks[input];
136 cerr << "Number of banks: " << _banks.size() << endl;
143 istringstream evidence(input);
147 _smell = value<int>(input);
154 istringstream player(input);
157 cerr << "Player: " << input << endl;
158 Player& pl = _players[input];
159 player >> pl.location;
162 cerr << "Number of players: " << _players.size() << endl;
165 void Bot::move(std::string location){
166 cout << "mov: " << location << " " << _type << endl;
170 T value(std::string input){
171 istringstream istr(input);
178 std::string Bot::turn(){