2015-08-04 04:42:28 +00:00
|
|
|
#include <stdlib.h>
|
2015-02-25 01:53:49 +00:00
|
|
|
#include "ai.h"
|
|
|
|
#include "engine.h"
|
2015-02-25 10:54:13 +00:00
|
|
|
#include "gfx.h"
|
2015-02-25 01:53:49 +00:00
|
|
|
|
|
|
|
const char moves[] = {'w', 'a', 's', 'd'};
|
|
|
|
|
|
|
|
int ai_move(struct gamestate *g)
|
|
|
|
{
|
2015-08-04 04:42:28 +00:00
|
|
|
/* Ensure srand is called somewhere prior */
|
2015-02-25 10:54:13 +00:00
|
|
|
if (g->opts->interactive) gfx_sleep(50);
|
2015-02-25 01:53:49 +00:00
|
|
|
return moves[rand() % 4];
|
|
|
|
}
|