X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=cop%2Fcop.cpp;h=f5a7f3f3e23f369c2291be78ee3042ea85a2678f;hb=3a68f935208fd4a2f5c4994cd74f3b4835c04c06;hp=3db7d419e329f0571946e93d7587f17112b8f251;hpb=b4beac0adea1d024521937c036075c7803596665;p=icfp05.git diff --git a/cop/cop.cpp b/cop/cop.cpp index 3db7d41..f5a7f3f 100644 --- a/cop/cop.cpp +++ b/cop/cop.cpp @@ -7,10 +7,66 @@ using namespace std; using namespace __gnu_cxx; string Cop::turn(){ - + string input; + + sendInformation(); + getInformation(); + + sendPlan(); + getPlans(); + + vote(); + + //Ignore vote + getline(cin,input); + return _location; } +void Cop::sendInformation(){ + cout << "inf\\" << endl; + cout << "inf/" << endl; +} + +void Cop::getInformation(){ + string input; + + //ignore From-inform + do{ + getline(cin,input); + }while(input != "from/"); +} + +void Cop::sendPlan(){ + cout << "plan\\" << endl; + //cout << "plan: " << _name << endl; + cout << "plan/" << endl; +} + +void Cop::getPlans(){ + string input; + + //ignore From-plan + do{ + getline(cin,input); + }while(input != "from/"); + + +} + +void Cop::vote(){ + cout << "vote\\" << endl; + cout << "vote: " << _name << endl; + for (hash_map::const_iterator player = _players.begin(); + player != _players.end(); ++player){ + if (player->second.type != robber && player->first != _name){ + cout << "vote: " << player->first << endl; + cerr << "voted for " << player->first << " of type: " << player->second.type << endl; + } + } + cout << "vote/" << endl; +} + int main(){ Cop cop("cop"); cop.play();