diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-19 15:22:00 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-19 15:22:00 +0100 |
| commit | 19ae4e74aedbbfde9aaed9241f616decc3ec9059 (patch) | |
| tree | c4eca1b207261e24b645d5d861b3b27631ead75e /src/rand_ai.cpp | |
| parent | c435852cc6147a0af23ef12cc0a07a195ac60756 (diff) | |
| download | 2048-19ae4e74aedbbfde9aaed9241f616decc3ec9059.tar.gz 2048-19ae4e74aedbbfde9aaed9241f616decc3ec9059.tar.bz2 2048-19ae4e74aedbbfde9aaed9241f616decc3ec9059.zip | |
Interface for ai (tested with random AI)
Diffstat (limited to 'src/rand_ai.cpp')
| -rw-r--r-- | src/rand_ai.cpp | 13 |
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]; +} |
