added getPlayerId(), no args version for MCTSAI caching

master
melvin 2011-06-15 11:21:25 +08:00
parent 0e14a8908f
commit 3c3cf9e1b6
1 changed files with 14 additions and 0 deletions

View File

@ -99,6 +99,20 @@ public class MagicPlayer implements MagicTarget {
return game.getPlayer(index);
}
public long getPlayerId() {
long playerId=0;
playerId=playerId*ID_FACTOR+life;
playerId=playerId*ID_FACTOR+poison;
playerId=playerId*ID_FACTOR+stateFlags;
playerId=playerId*ID_FACTOR+library.size();
playerId=playerId*ID_FACTOR+activationMap.size();
playerId=playerId*ID_FACTOR+builderCost.getMinimumAmount();
playerId=playerId*ID_FACTOR+permanents.getPermanentsId();
playerId=playerId*ID_FACTOR+hand.getCardsId();
playerId=playerId*ID_FACTOR+graveyard.getCardsId();
return playerId;
}
public long getPlayerId(final long id) {
// Exile is not used for id.
long playerId=id;