mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
adjustment to GameState.getValue
This commit is contained in:
parent
550ad2bc69
commit
a1f1ed44c0
5 changed files with 11 additions and 7 deletions
|
@ -233,7 +233,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
|||
root = root.children.get(0);
|
||||
}
|
||||
logger.info("simlating -- game value:" + game.getState().getValue() + " test value:" + test.gameValue);
|
||||
if (root.playerId.equals(playerId) && root.abilities != null && game.getState().getValue() == test.gameValue) {
|
||||
if (root.playerId.equals(playerId) && root.abilities != null && game.getState().getValue().hashCode() == test.gameValue) {
|
||||
|
||||
/*
|
||||
// Try to fix horizon effect
|
||||
|
@ -442,7 +442,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
|||
logger.info("interrupted");
|
||||
return GameStateEvaluator2.evaluate(playerId, game);
|
||||
}
|
||||
node.setGameValue(game.getState().getValue());
|
||||
node.setGameValue(game.getState().getValue().hashCode());
|
||||
SimulatedPlayer2 currentPlayer = (SimulatedPlayer2) game.getPlayer(game.getPlayerList().get());
|
||||
//logger.info("simulating -- player " + currentPlayer.getName());
|
||||
SimulationNode2 bestNode = null;
|
||||
|
|
|
@ -211,7 +211,7 @@ public class ComputerPlayer2 extends ComputerPlayer<ComputerPlayer2> implements
|
|||
root = root.children.get(0);
|
||||
}
|
||||
logger.debug("simlating -- game value:" + game.getState().getValue() + " test value:" + test.gameValue);
|
||||
if (root.playerId.equals(playerId) && root.abilities != null && game.getState().getValue() == test.gameValue) {
|
||||
if (root.playerId.equals(playerId) && root.abilities != null && game.getState().getValue().hashCode() == test.gameValue) {
|
||||
logger.debug("simulating -- continuing previous action chain");
|
||||
actions = new LinkedList<Ability>(root.abilities);
|
||||
combat = root.combat;
|
||||
|
@ -412,7 +412,7 @@ public class ComputerPlayer2 extends ComputerPlayer<ComputerPlayer2> implements
|
|||
logger.debug(indent(node.depth) + "interrupted");
|
||||
return GameStateEvaluator.evaluate(playerId, game);
|
||||
}
|
||||
node.setGameValue(game.getState().getValue());
|
||||
node.setGameValue(game.getState().getValue().hashCode());
|
||||
SimulatedPlayer currentPlayer = (SimulatedPlayer) game.getPlayer(game.getPlayerList().get());
|
||||
boolean isSimulatedPlayer = currentPlayer.getId().equals(playerId);
|
||||
logger.debug(indent(node.depth) + "simulating priority -- player " + currentPlayer.getName());
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -157,13 +157,13 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
playerList.add(player.getId());
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
public String getValue() {
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
|
||||
sb.append(turnNum).append(turn.getPhaseType()).append(turn.getStepType()).append(activePlayerId).append(priorityPlayerId);
|
||||
|
||||
for (Player player: players.values()) {
|
||||
sb.append("player").append(player.getLife()).append(player.getHand()).append(player.getLibrary().getCardList());
|
||||
sb.append("player").append(player.getLife()).append("hand").append(player.getHand()).append("library").append(player.getLibrary().size()).append("graveyard").append(player.getGraveyard());
|
||||
}
|
||||
|
||||
for (UUID permanentId: battlefield.getAllPermanentIds()) {
|
||||
|
@ -173,8 +173,12 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
for (StackObject spell: stack) {
|
||||
sb.append("spell").append(spell.getId());
|
||||
}
|
||||
|
||||
for (ExileZone zone: exile.getExileZones()) {
|
||||
sb.append("exile").append(zone.getName()).append(zone);
|
||||
}
|
||||
|
||||
return sb.toString().hashCode();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Players getPlayers() {
|
||||
|
|
Loading…
Reference in a new issue