From 518c5700d8f00b70e2b5b6d448efb7b474d57157 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 25 Jun 2005 21:38:56 +0000 Subject: [PATCH] bugfix --- bot/bot.cpp | 10 +++++----- cop/cop.cpp | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/bot/bot.cpp b/bot/bot.cpp index 6a48602..181b423 100644 --- a/bot/bot.cpp +++ b/bot/bot.cpp @@ -72,15 +72,15 @@ void Bot::play(){ //robber and 5 cops getline(cin, input); - _players[value(input)]; + _players[value(input)].type = robber; getline(cin, input); - _players[value(input)]; + _players[value(input)].type = cop_foot; getline(cin, input); - _players[value(input)]; + _players[value(input)].type = cop_foot; getline(cin, input); - _players[value(input)]; + _players[value(input)].type = cop_foot; getline(cin, input); - _players[value(input)]; + _players[value(input)].type = cop_foot; cerr << "Got players, building graph." << endl; getline(cin, input); diff --git a/cop/cop.cpp b/cop/cop.cpp index 3db7d41..7621563 100644 --- a/cop/cop.cpp +++ b/cop/cop.cpp @@ -7,7 +7,39 @@ using namespace std; using namespace __gnu_cxx; string Cop::turn(){ - + cout << "inf\\" << endl; + cout << "inf/" << endl; + + string input; + + //ignore From-inform + do{ + getline(cin,input); + }while(input != "from/"); + + cout << "plan\\" << endl; + //cout << "plan: " << _name << endl; + cout << "plan/" << endl; + + //ignore From-plan + do{ + getline(cin,input); + }while(input != "from/"); + + 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; + + //Ignore vote + getline(cin,input); + return _location; } -- 2.39.2