getline(cin, input);
if (input == "game-over")
return;
- cerr << input << endl;
- cerr << "Updating world" << endl;
+ //cerr << input << endl;
+ //cerr << "Updating world" << endl;
updateWorld();
- cerr << "Done updating world" << endl;
+ //cerr << "Done updating world" << endl;
_type = _players[_name].type;
_location = _players[_name].location;
//cerr << "New turn" << endl;
if (type == "foot"){
_intersections[from].connections[to] = both;
Intersection& inter = _intersections[to];
- if (inter.connections.find(from) == inter.connections.end())
+ hash_map<string,StreetType>::iterator conn = inter.connections.find(from);
+ if (conn == inter.connections.end())
inter.connections[from] = foot;
- }else
- _intersections[from].connections[to] = car;
+ else if (conn->second == car)
+ inter.connections[from] = both;
+ }else{
+ Intersection& inter = _intersections[from];
+ hash_map<string,StreetType>::iterator conn = inter.connections.find(to);
+ if (conn == inter.connections.end())
+ inter.connections[from] = car;
+ else if (conn->second == foot)
+ inter.connections[from] = both;
+ }
}
//cerr << "Number of streets: " << streets << endl;
getline(cin, input);
}
void Bot::updateWorld(){
- cerr << "Entered updateWorld function" << endl;
string input;
getline(cin,input);
- cerr << input << endl;
_world = value<int>(input);
- cerr << "World: " << _world << endl;
+ //cerr << "World: " << _world << endl;
getline(cin,input);
_robbed = value<int>(input);
}
std::string Bot::turn(){
- cerr << "Using stupid stand still Bot::turn" << endl;
+ //cerr << "Using stupid stand still Bot::turn" << endl;
return _location;
}