Package mage.game

Examples of mage.game.TwoPlayerDuel


            playOneGame();
        }
    }

    private void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
        Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, 0, 20);

        Player computerA = createRandomPlayer("ComputerA");
        Deck deck = generateRandomDeck();

        if (deck.getCards().size() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
        }
        game.addPlayer(computerA, deck);
        game.loadCards(deck.getCards(), computerA.getId());

        Player computerB = createRandomPlayer("ComputerB");
        Deck deck2 = generateRandomDeck();
        if (deck2.getCards().size() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck2.getCards().size());
        }
        game.addPlayer(computerB, deck2);
        game.loadCards(deck2.getCards(), computerB.getId());

        boolean testMode = true;

        long t1 = System.nanoTime();
        GameOptions options = new GameOptions();
        options.testMode = true;
        game.start(computerA.getId(), options);
        long t2 = System.nanoTime();

        logger.info("Winner: " + game.getWinner());
        logger.info("Time: " + (t2 - t1) / 1000000 + " ms");
    }
View Full Code Here


    private static List<String> colorChoices = Arrays.asList("bu", "bg", "br", "bw", "ug", "ur", "uw", "gr", "gw", "rw", "bur", "buw", "bug", "brg", "brw", "bgw", "wur", "wug", "wrg", "rgu");

    @Ignore
    @Test
    public void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
        Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, 0, 20);

        Player computerA = createPlayer("ComputerA", "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() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
        }
        game.addPlayer(computerA, deck);
        game.loadCards(deck.getCards(), computerA.getId());

        Player computerB = createPlayer("ComputerB", "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() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck2.getCards().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.start(computerA.getId(), options);
        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 :(");
        }*/
    }
View Full Code Here

            logger.debug("Resetting previous game and creating new one!");
            currentGame = null;
            System.gc();
        }

        Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, 0, 20);

        playerA = createNewPlayer("PlayerA");
        playerA.setTestMode(true);
        logger.debug("Loading deck...");
        Deck deck = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"), false, false);
        logger.debug("Done!");
        if (deck.getCards().size() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
        }       
        game.loadCards(deck.getCards(), playerA.getId());
        game.addPlayer(playerA, deck);

        playerB = createNewPlayer("PlayerB");
        playerB.setTestMode(true);
        Deck deck2 = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"), false, false);
        if (deck2.getCards().size() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck2.getCards().size());
        }       
        game.loadCards(deck2.getCards(), playerB.getId());
        game.addPlayer(playerB, deck2);
        activePlayer = playerA;
        currentGame = game;

        stopOnTurn = 2;
        stopAtStep = PhaseStep.UNTAP;
View Full Code Here

            logger.debug("Resetting previous game and creating new one!");
            currentGame = null;
            System.gc();
        }

        Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, 0, 20);

        playerA = createNewPlayer("ComputerA");
        playerA.setTestMode(true);

        Deck deck = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"), false, false);

        if (deck.getCards().size() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
        }
        game.addPlayer(playerA, deck);
        game.loadCards(deck.getCards(), playerA.getId());

        playerB = createNewPlayer("ComputerB");
        playerB.setTestMode(true);
        Deck deck2 = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"), false, false);
        if (deck2.getCards().size() < 40) {
            throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck2.getCards().size());
        }
        game.addPlayer(playerB, deck2);
        game.loadCards(deck2.getCards(), playerB.getId());

        parseScenario(cardPath);

        activePlayer = playerA;
        currentGame = game;
View Full Code Here

TOP

Related Classes of mage.game.TwoPlayerDuel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.