- modified gameOver to be protected and defined two new operations to do the same thing (didWin and setLoser)
- removed ACTION_LOGGING_TESTING code - Fixed AIvsAI games multithreaded games - Activated undo when testsuite is enable - Defined an initial player comparison operator - Fixed multi-threaded modification to subtypes - Fixed gameTurn cleanup for gameObserver reuse
This commit is contained in:
@@ -348,4 +348,32 @@ ostream& operator<<(ostream& out, const Player& p)
|
||||
return out;
|
||||
}
|
||||
|
||||
// Method comparing "this" to "aPlayer", each in their own gameObserver
|
||||
bool Player::operator<(Player& aPlayer)
|
||||
{
|
||||
// if this is dead and aPlayer is not dead then this < aPlayer
|
||||
if(isDead() && !aPlayer.isDead())
|
||||
return true;
|
||||
|
||||
// heuristics for min-max
|
||||
|
||||
// if this is more poisoined than aPlayer then this < aPlayer
|
||||
if(poisonCount > aPlayer.poisonCount)
|
||||
return true;
|
||||
|
||||
// if this has less life than aPlayer then this < aPlayer
|
||||
if(life < aPlayer.life)
|
||||
return true;
|
||||
|
||||
// if this has less parmanents in game that aPlayer then this < aPlayer
|
||||
if(game->battlefield->cards.size() < aPlayer.game->battlefield->cards.size())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Player::isDead() {
|
||||
if(observer)
|
||||
return observer->didWin(opponent());
|
||||
return false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user