]> ruin.nu Git - icfp05.git/commitdiff
initial commit
authorMichael Andreen <harv@ruin.nu>
Fri, 24 Jun 2005 21:35:49 +0000 (21:35 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 24 Jun 2005 21:35:49 +0000 (21:35 +0000)
robber/robber.cpp [new file with mode: 0644]
robber/robber.h [new file with mode: 0644]
robber/robber.pro [new file with mode: 0644]

diff --git a/robber/robber.cpp b/robber/robber.cpp
new file mode 100644 (file)
index 0000000..c888362
--- /dev/null
@@ -0,0 +1,30 @@
+#include "robber.h"
+#include <iostream>
+
+using namespace std;
+using namespace __gnu_cxx;
+
+string Robber::turn(){
+
+       Intersection& inter = _intersections[_location];
+       
+       cerr << "Number of connecting streets: " << inter.connections.size() << endl;
+
+       for (hash_map<string,StreetType>::const_iterator street = inter.connections.begin();
+               street != inter.connections.end(); ++street){
+               cerr << "Checking: " << street->first << endl;
+               if (street->second != car){
+                       cerr << "Moving to: " << street->first << endl;
+                       return street->first;
+               }
+       }
+       return _location;
+       
+}
+
+int main(){
+       Robber robber("robber");
+       robber.play();
+
+       return 0;
+}
diff --git a/robber/robber.h b/robber/robber.h
new file mode 100644 (file)
index 0000000..11f5668
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __ROBBER_H__
+#define __ROBBER_H__
+
+#include <bot.h>
+
+class Robber : public Bot {
+       public:
+               Robber(std::string name):Bot(name,"robber"){};
+               
+               std::string turn();
+};
+#endif
diff --git a/robber/robber.pro b/robber/robber.pro
new file mode 100644 (file)
index 0000000..dd31e91
--- /dev/null
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (1.07a) Fri Jun 24 23:15:16 2005
+######################################################################
+
+TEMPLATE = app
+INCLUDEPATH += ../bot
+CONFIG -= qt
+
+
+# Input
+HEADERS += robber.h
+SOURCES += robber.cpp ../bot/bot.cpp