Search in sources :

Example 1 with HumanPlayer

use of mage.player.human.HumanPlayer in project mage by magefree.

the class RandomTest method test_GenerateRandomPlanarDicePng.

@Test
@Ignore
public void test_GenerateRandomPlanarDicePng() throws IOException {
    String dest = "f:/test/xmage/";
    // RandomUtil.setSeed(123);
    Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
    Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 50);
    int height = 512;
    int weight = 512;
    BufferedImage image = new BufferedImage(weight, height, BufferedImage.TYPE_INT_RGB);
    for (int x = 0; x < weight; x++) {
        for (int y = 0; y < height; y++) {
            // roll planar dice
            PlanarDieRollResult res = player.rollPlanarDie(Outcome.Neutral, null, game);
            image.setRGB(x, y, new Color(res.equals(PlanarDieRollResult.CHAOS_ROLL) ? 255 : 0, res.equals(PlanarDieRollResult.PLANAR_ROLL) ? 255 : 0, res.equals(PlanarDieRollResult.BLANK_ROLL) ? 255 : 0).getRGB());
        }
    }
    ImageIO.write(image, "png", new File(dest + "xmage_random_planar_dice.png"));
}
Also used : Player(mage.players.Player) HumanPlayer(mage.player.human.HumanPlayer) Game(mage.game.Game) PlanarDieRollResult(mage.constants.PlanarDieRollResult) HumanPlayer(mage.player.human.HumanPlayer) TwoPlayerDuel(mage.game.TwoPlayerDuel) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with HumanPlayer

use of mage.player.human.HumanPlayer in project mage by magefree.

the class RandomTest method test_GenerateRandomDicePng.

@Test
@Ignore
public void test_GenerateRandomDicePng() throws IOException {
    String dest = "f:/test/xmage/";
    // RandomUtil.setSeed(123);
    Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
    Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 50);
    int height = 512;
    int weight = 512;
    BufferedImage image = new BufferedImage(weight, height, BufferedImage.TYPE_INT_RGB);
    for (int x = 0; x < weight; x++) {
        for (int y = 0; y < height; y++) {
            // roll dice
            int diceVal = player.rollDice(Outcome.Neutral, null, game, 12);
            int colorMult = Math.floorDiv(255, 12);
            image.setRGB(x, y, new Color(colorMult * diceVal, colorMult * diceVal, colorMult * diceVal).getRGB());
        }
    }
    ImageIO.write(image, "png", new File(dest + "xmage_random_dice.png"));
}
Also used : Player(mage.players.Player) HumanPlayer(mage.player.human.HumanPlayer) Game(mage.game.Game) HumanPlayer(mage.player.human.HumanPlayer) TwoPlayerDuel(mage.game.TwoPlayerDuel) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with HumanPlayer

use of mage.player.human.HumanPlayer in project mage by magefree.

the class RandomTest method test_GenerateRandomLibraryShufflePng.

@Test
@Ignore
public void test_GenerateRandomLibraryShufflePng() throws IOException {
    String dest = "f:/test/xmage/";
    // RandomUtil.setSeed(123);
    Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
    Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 50);
    Deck deck = DeckTestUtils.buildRandomDeck("WGUBR", false, "GRN");
    player.getLibrary().addAll(deck.getCards(), game);
    // multiple cards analyze
    for (int i = 0; i < player.getLibrary().size(); i++) {
        UUID cardId = player.getLibrary().getCardList().get(i);
        // int halfIndex = Math.floorDiv(player.getLibrary().size(), 2);
        int colorMult = Math.floorDiv(255, player.getLibrary().size());
        int height = 512;
        int weight = 512;
        BufferedImage image = new BufferedImage(weight, height, BufferedImage.TYPE_INT_RGB);
        for (int x = 0; x < weight; x++) {
            for (int y = 0; y < height; y++) {
                // shuffle, search card position and draw
                player.getLibrary().shuffle();
                int cardPos = player.getLibrary().getCardPosition(cardId);
                // image.setRGB(x, y, cardPos < halfIndex ? Color.white.getRGB() : Color.black.getRGB());
                image.setRGB(x, y, new Color(colorMult * cardPos, colorMult * cardPos, colorMult * cardPos).getRGB());
            }
        }
        ImageIO.write(image, "png", new File(dest + "xmage_random_shuffle_" + i + ".png"));
    }
}
Also used : Player(mage.players.Player) HumanPlayer(mage.player.human.HumanPlayer) Game(mage.game.Game) HumanPlayer(mage.player.human.HumanPlayer) TwoPlayerDuel(mage.game.TwoPlayerDuel) Deck(mage.cards.decks.Deck) UUID(java.util.UUID) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

BufferedImage (java.awt.image.BufferedImage)3 File (java.io.File)3 Game (mage.game.Game)3 TwoPlayerDuel (mage.game.TwoPlayerDuel)3 HumanPlayer (mage.player.human.HumanPlayer)3 Player (mage.players.Player)3 Ignore (org.junit.Ignore)3 Test (org.junit.Test)3 UUID (java.util.UUID)1 Deck (mage.cards.decks.Deck)1 PlanarDieRollResult (mage.constants.PlanarDieRollResult)1