- Added poison counter check into the testsuite

- Decorelated the testsuite AI timer from the game timer to be able to have reproduceable results with AI tests.
- Created a random generator wrapper class
- Used two seperate instances of this random generator for AI and for the game
- Added methods to load randoms into AI from a testcase
- Fixed a probleme with undo and premade decks introduced in r4035
- Added basic test to test AI proliferate code
- Cleaned up goblin_artillery test
- Added AI tests into the testsuite test list
- Fixed looping bug into the multi target AI code
This commit is contained in:
Xawotihs
2011-10-30 14:31:27 +00:00
parent 53b9bc412f
commit 2f4dd4cd2a
19 changed files with 195 additions and 98 deletions

View File

@@ -86,11 +86,13 @@ GameObserver::~GameObserver()
}
GameObserver::GameObserver()
: randomGenerator(true)
{
initialize();
}
GameObserver::GameObserver(vector<Player *> _players)
: randomGenerator(true)
{
initialize();
setPlayers(_players);
@@ -1279,7 +1281,7 @@ ostream& operator<<(ostream& out, GameObserver& g)
else
{
out << "rvalues:";
out << saveRandValues(out);
out << g.randomGenerator.saveUsedRandValues(out);
out << endl;
out << g.startupGameSerialized;
}
@@ -1327,7 +1329,7 @@ bool GameObserver::load(const string& ss, bool undo)
string deckFileSmall = "";//players[0]->deckFileSmall;
DebugTrace("Loading " + ss);
loadRandValues("");
randomGenerator.loadRandValues("");
cleanup();
@@ -1345,7 +1347,7 @@ bool GameObserver::load(const string& ss, bool undo)
}
if (s.find("rvalues:") == 0)
{
loadRandValues(s.substr(8).c_str());
randomGenerator.loadRandValues(s.substr(8).c_str());
continue;
}
switch (state)
@@ -1612,7 +1614,7 @@ void GameObserver::loadPlayer(int playerId, PlayerType playerType, int decknb, b
Player * opponent = NULL;
// Reset the random logging.
loadRandValues("");
randomGenerator.loadRandValues("");
if (playerId == 1) opponent = players[0];
#ifdef AI_CHANGE_TESTING