use of mage.game.GameOptions in project mage by magefree.
the class PlayGameTest method playOneGame.
@Ignore
@Test
public void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Player computerA = createPlayer("ComputerA", PlayerType.COMPUTER_MINIMAX_HYBRID);
// Player playerA = createPlayer("ComputerA", "Computer - mad");
// Deck deck = Deck.load(Sets.loadDeck("RB Aggro.dck"));
Deck deck = generateRandomDeck();
if (deck.getCards().size() < DECK_SIZE) {
throw new IllegalArgumentException("Couldn't load deck, deck size = " + deck.getCards().size() + ", but must be " + DECK_SIZE);
}
game.addPlayer(computerA, deck);
game.loadCards(deck.getCards(), computerA.getId());
Player computerB = createPlayer("ComputerB", PlayerType.COMPUTER_MINIMAX_HYBRID);
// Player playerB = createPlayer("ComputerB", "Computer - mad");
// Deck deck2 = Deck.load(Sets.loadDeck("RB Aggro.dck"));
Deck deck2 = generateRandomDeck();
if (deck2.getCards().size() < DECK_SIZE) {
throw new IllegalArgumentException("Couldn't load deck, deck size = " + deck2.getCards().size() + ", but must be " + DECK_SIZE);
}
game.addPlayer(computerB, deck2);
game.loadCards(deck2.getCards(), computerB.getId());
// parseScenario("scenario1.txt");
// game.cheat(playerA.getId(), commandsA);
// game.cheat(playerA.getId(), libraryCardsA, handCardsA, battlefieldCardsA, graveyardCardsA);
// game.cheat(playerB.getId(), commandsB);
// game.cheat(playerB.getId(), libraryCardsB, handCardsB, battlefieldCardsB, graveyardCardsB);
// boolean testMode = false;
boolean testMode = true;
long t1 = System.nanoTime();
GameOptions options = new GameOptions();
options.testMode = true;
game.setGameOptions(options);
game.start(computerA.getId());
long t2 = System.nanoTime();
logger.info("Winner: " + game.getWinner());
logger.info("Time: " + (t2 - t1) / 1000000 + " ms");
/*if (!game.getWinner().equals("Player ComputerA is the winner")) {
throw new RuntimeException("Lost :(");
}*/
}
use of mage.game.GameOptions in project mage by magefree.
the class TestPlayRandomGame method playOneGame.
private void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Player computerA = createRandomPlayer("ComputerA");
Deck deck = generateRandomDeck();
if (deck.getCards().size() < DECK_SIZE) {
throw new IllegalArgumentException("Couldn't load deck, deck size = " + deck.getCards().size() + ", but must be " + DECK_SIZE);
}
game.addPlayer(computerA, deck);
game.loadCards(deck.getCards(), computerA.getId());
Player computerB = createRandomPlayer("ComputerB");
Deck deck2 = generateRandomDeck();
if (deck2.getCards().size() < DECK_SIZE) {
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck2.getCards().size() + ", but must be " + DECK_SIZE);
}
game.addPlayer(computerB, deck2);
game.loadCards(deck2.getCards(), computerB.getId());
long t1 = System.nanoTime();
GameOptions options = new GameOptions();
options.testMode = true;
game.setGameOptions(options);
game.start(computerA.getId());
long t2 = System.nanoTime();
logger.info("Winner: " + game.getWinner());
logger.info("Time: " + (t2 - t1) / 1000000 + " ms");
}
Aggregations