]> ruin.nu Git - icfp05.git/commitdiff
some restructuring
authorMichael Andreen <harv@ruin.nu>
Sun, 26 Jun 2005 10:35:54 +0000 (10:35 +0000)
committerMichael Andreen <harv@ruin.nu>
Sun, 26 Jun 2005 10:35:54 +0000 (10:35 +0000)
cop/cop.cpp
cop/cop.h

index 76215630ad1d2e946c6455256980bd9545f8ad18..f5a7f3f3e23f369c2291be78ee3042ea85a2678f 100644 (file)
@@ -7,25 +7,54 @@ 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();
@@ -36,11 +65,6 @@ string Cop::turn(){
                }
        }
        cout << "vote/" << endl;
-
-       //Ignore vote
-       getline(cin,input);
-
-       return _location;
 }
 
 int main(){
index 23533a686266c8cbb9e831d080bd6f3d62a4c896..42cb7787d0d13e420be84f332354e2fb556698a4 100644 (file)
--- a/cop/cop.h
+++ b/cop/cop.h
@@ -8,5 +8,11 @@ class Cop : public Bot {
                Cop(std::string name):Bot(name,cop_foot){};
                
                std::string turn();
+       protected:
+               void sendInformation();
+               void getInformation();
+               void sendPlan();
+               void getPlans();
+               void vote();
 };
 #endif