]> ruin.nu Git - icfp05.git/blobdiff - bot/bot.cpp
moved abstract base class to it's own subdir
[icfp05.git] / bot / bot.cpp
diff --git a/bot/bot.cpp b/bot/bot.cpp
new file mode 100644 (file)
index 0000000..c7af4a6
--- /dev/null
@@ -0,0 +1,38 @@
+#include <iostream>
+#include <sstream>
+#include <iterator>
+#include "bot.h"
+
+using namespace std;
+using namespace __gnu_cxx;
+
+Bot::Bot(string name, string type){
+       _name = name;
+       _type = type;
+}
+
+void Bot::play(){
+       cout << "reg: " << _name << " " << _type << endl;
+
+       string input;
+       getline(cin, input);
+       if (input != "wsk\\")
+               return;
+       getline(cin, input);
+       _name = tokenizeString(input)[1];
+       cerr << "Got name: " << _name << endl;
+       buildGraph();
+       updateWorld();
+       turn();
+}
+
+void Bot::buildGraph(){
+
+}
+
+std::vector<std::string> tokenizeString(std::string input){
+       istringstream istr(input);
+       vector<string> strings;
+       copy(istream_iterator<string>(istr), istream_iterator<string>(), back_inserter(strings));
+       return strings;
+}