aboutsummaryrefslogtreecommitdiff
path: root/src/rand_ai.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rand_ai.cpp')
-rw-r--r--src/rand_ai.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rand_ai.cpp b/src/rand_ai.cpp
new file mode 100644
index 0000000..db2cf4f
--- /dev/null
+++ b/src/rand_ai.cpp
@@ -0,0 +1,13 @@
+#include "rand_ai.hpp"
+
+RandAI::RandAI(Game *g)
+{
+ game = g;
+}
+
+Direction RandAI::move()
+{
+ Direction directions[4] = {DIRECTION_LEFT, DIRECTION_RIGHT,
+ DIRECTION_DOWN, DIRECTION_UP};
+ return directions[rand() % 4];
+}