]> ruin.nu Git - icfp05.git/blob - bot/bot.cpp
moved abstract base class to it's own subdir
[icfp05.git] / bot / bot.cpp
1 #include <iostream>
2 #include <sstream>
3 #include <iterator>
4 #include "bot.h"
5
6 using namespace std;
7 using namespace __gnu_cxx;
8
9 Bot::Bot(string name, string type){
10         _name = name;
11         _type = type;
12 }
13
14 void Bot::play(){
15         cout << "reg: " << _name << " " << _type << endl;
16
17         string input;
18         getline(cin, input);
19         if (input != "wsk\\")
20                 return;
21         getline(cin, input);
22         _name = tokenizeString(input)[1];
23         cerr << "Got name: " << _name << endl;
24         buildGraph();
25         updateWorld();
26         turn();
27 }
28
29 void Bot::buildGraph(){
30
31 }
32
33 std::vector<std::string> tokenizeString(std::string input){
34         istringstream istr(input);
35         vector<string> strings;
36         copy(istream_iterator<string>(istr), istream_iterator<string>(), back_inserter(strings));
37         return strings;
38 }