]> ruin.nu Git - icfp05.git/blobdiff - copsrc/cop.cpp
renamed dirs
[icfp05.git] / copsrc / cop.cpp
diff --git a/copsrc/cop.cpp b/copsrc/cop.cpp
new file mode 100644 (file)
index 0000000..f5a7f3f
--- /dev/null
@@ -0,0 +1,75 @@
+#include "cop.h"
+#include <iostream>
+#include <iterator>
+#include <cmath>
+
+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<string,Player>::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();
+
+       return 0;
+}