1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Imposed time limits on AIs.

Simple action validation.
This commit is contained in:
Michał W. Urbańczyk
2011-10-11 13:16:28 +00:00
parent 94e7fa5b3c
commit c8115d41a8
11 changed files with 267 additions and 53 deletions

View File

@ -1,5 +1,6 @@
#include <cstring>
#include "../../AI_Base.h"
#include "../../lib/CBattleCallback.h"
const char *g_cszAiName = "Mad AI";
@ -16,13 +17,17 @@ class CMadAI : public CBattleGameInterface
virtual BattleAction activeStack(const CStack * stack)
{
// int *g = 0;
// *g = 4;
// while(1);
srand(time(NULL));
BattleAction ba;
ba.actionType = rand() % 14;
ba.additionalInfo = rand() % BFIELD_SIZE + 5;
ba.side = rand() % 7;
ba.destinationTile = rand() % BFIELD_SIZE + 5;
ba.stackNumber = rand() % 500;
ba.stackNumber = rand() % cb->battleGetAllStacks().size() + 1;
return ba;
}
};