]> ruin.nu Git - icfp05.git/blob - copsrc/cop.cpp
renamed dirs
[icfp05.git] / copsrc / cop.cpp
1 #include "cop.h"
2 #include <iostream>
3 #include <iterator>
4 #include <cmath>
5
6 using namespace std;
7 using namespace __gnu_cxx;
8
9 string Cop::turn(){
10         string input;
11
12         sendInformation();
13         getInformation();
14
15         sendPlan();
16         getPlans();
17
18         vote();
19
20         //Ignore vote
21         getline(cin,input);
22
23         return _location;
24 }
25
26 void Cop::sendInformation(){
27         cout << "inf\\" << endl;
28         cout << "inf/" << endl;
29 }
30
31 void Cop::getInformation(){
32         string input;
33
34         //ignore From-inform
35         do{
36                 getline(cin,input);
37         }while(input != "from/");
38 }
39
40 void Cop::sendPlan(){
41         cout << "plan\\" << endl;
42         //cout << "plan: " << _name << endl;
43         cout << "plan/" << endl;
44 }
45
46 void Cop::getPlans(){
47         string input;
48
49         //ignore From-plan
50         do{
51                 getline(cin,input);
52         }while(input != "from/");
53
54
55 }
56
57 void Cop::vote(){
58         cout << "vote\\" << endl;
59         cout << "vote: " << _name << endl;
60         for (hash_map<string,Player>::const_iterator player = _players.begin();
61                         player != _players.end(); ++player){
62                 if (player->second.type != robber && player->first != _name){
63                         cout << "vote: " << player->first << endl;
64                         cerr << "voted for " << player->first << " of type: " << player->second.type << endl;
65                 }
66         }
67         cout << "vote/" << endl;
68 }
69
70 int main(){
71         Cop cop("cop");
72         cop.play();
73
74         return 0;
75 }