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"));
}
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"));
}
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"));
}
}
Aggregations