Files
wagic/projects/mtg/include/TestSuiteAI.h
wagic.the.homebrew@gmail.com 0bf83b6bf5 Erwan
- fixed a bug with Flagstones of Trokair. There was no easy fix (cloned objects deleting stuff from their parents...) and I ended up using a "garbage collect at end of turn" technique the way I did with the ActionStack. As a result, the memory print of a turn will become bigger, and even more bugs might occur at the end of a turn... I'm ready to discuss this, although I think it's the best solution (in terms of result/amount of work) given the way abilities work right now
- Test suite now gives the number of failed/success at the end of the tests
2009-09-26 14:25:29 +00:00

94 lines
1.8 KiB
C++

#ifndef _TESTSUITE_AI_H_
#define _TESTSUITE_AI_H_
#define MAX_TESTSUITE_ACTIONS 100
#define MAX_TESTUITE_CARDS 100
#include "../include/AIPlayer.h"
class TestSuiteActions{
public:
int nbitems;
string actions[MAX_TESTSUITE_ACTIONS];
void add(string action);
TestSuiteActions();
void cleanup();
};
class TestSuitePlayerZone{
public:
int cards[MAX_TESTUITE_CARDS];
int nbitems;
void add(int cardid);
TestSuitePlayerZone();
void cleanup();
};
class TestSuitePlayerData{
public:
int life;
ManaCost * manapool;
TestSuitePlayerZone zones[5];
TestSuitePlayerData();
~TestSuitePlayerData();
void cleanup();
};
class TestSuite;
class TestSuiteState{
public:
int phase;
void parsePlayerState(int playerId, string s,TestSuite * suite);
TestSuiteState();
TestSuitePlayerData playerData[2];
void cleanup();
};
class TestSuite{
public:
MTGAllCards* collection;
int summoningSickness;
int gameType;
float timerLimit;
int currentAction;
TestSuiteState initState;
TestSuiteState endState;
TestSuiteActions actions;
string files[1024];
int nbfiles;
int currentfile;
int nbFailed, nbTests;
int load(const char * filename);
TestSuite(const char * filename,MTGAllCards* _collection);
void initGame();
int assertGame();
MTGPlayerCards * buildDeck(int playerId);
string getNextAction();
int phaseStrToInt(string s);
MTGCardInstance * getCardByMTGId(int mtgid);
Interruptible * getActionByMTGId(int mtgid);
int loadNext();
void cleanup();
int Log(const char * text);
int getMTGId(string name);
};
class TestSuiteAI:public AIPlayerBaka{
public:
TestSuite * suite;
float timer;
int playMode;
TestSuiteAI(TestSuite * suite, int playerId);
virtual int Act(float dt);
virtual int displayStack();
};
#endif