default implementation of getSimulationChoiceResults is to generate all artifical choice results and randomly choose one, specific choice class should provide more efficient implmentations that does not need to generate all choices

master
melvin 2011-06-07 09:53:06 +08:00
parent 568b81049a
commit 7844861cc2
1 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import java.util.List;
import magic.model.MagicGame;
import magic.model.MagicPlayer;
import magic.model.MagicSource;
import magic.model.MagicRandom;
import magic.model.event.MagicEvent;
import magic.ui.GameController;
@ -71,6 +72,16 @@ public abstract class MagicChoice {
return Collections.emptyList();
}
}
/** Gets one choice results for simulation. */
public Object[] getSimulationChoiceResults(
final MagicGame game,
final MagicEvent event,
final MagicPlayer player,
final MagicSource source) {
final List<Object[]> choices = getArtificialChoiceResults(game, event, player, source);
return choices.get(MagicRandom.nextInt(choices.size()));
}
/** Gets the choice results of the player. */
public abstract Object[] getPlayerChoiceResults(final GameController controller,final MagicGame game,final MagicPlayer player,final MagicSource source);