mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 05:09:16 -08:00
tests: improve booster generation summary output
This commit is contained in:
parent
f690ddd4de
commit
8bcac56550
1 changed files with 17 additions and 5 deletions
|
|
@ -514,8 +514,9 @@ public class BoosterGenerationTest extends MageTestPlayerBase {
|
||||||
@Ignore // debug only: collect info about cards in boosters, see https://github.com/magefree/mage/issues/8081
|
@Ignore // debug only: collect info about cards in boosters, see https://github.com/magefree/mage/issues/8081
|
||||||
@Test
|
@Test
|
||||||
public void test_CollectBoosterStats() {
|
public void test_CollectBoosterStats() {
|
||||||
ExpansionSet setToAnalyse = ModernHorizons3.getInstance();
|
ExpansionSet setToAnalyse = NewPhyrexia.getInstance();
|
||||||
int openBoosters = 10000;
|
// Takes about a minute for 100,000 boosters
|
||||||
|
int openBoosters = 100000;
|
||||||
|
|
||||||
Map<String, Integer> resRatio = new HashMap<>();
|
Map<String, Integer> resRatio = new HashMap<>();
|
||||||
int totalCards = 0;
|
int totalCards = 0;
|
||||||
|
|
@ -523,11 +524,23 @@ public class BoosterGenerationTest extends MageTestPlayerBase {
|
||||||
List<Card> booster = setToAnalyse.createBooster();
|
List<Card> booster = setToAnalyse.createBooster();
|
||||||
totalCards += booster.size();
|
totalCards += booster.size();
|
||||||
booster.forEach(card -> {
|
booster.forEach(card -> {
|
||||||
String code = String.format("%s %s %s", card.getExpansionSetCode(), card.getRarity().getCode(), card.getName());
|
String code = String.format("%s %s %s", card.getExpansionSetCode(), card.getRarity().toString().charAt(0), card.getName());
|
||||||
resRatio.putIfAbsent(code, 0);
|
resRatio.putIfAbsent(code, 0);
|
||||||
resRatio.computeIfPresent(code, (u, count) -> count + 1);
|
resRatio.computeIfPresent(code, (u, count) -> count + 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
System.out.println(setToAnalyse.getName() + " - boosters opened: " + openBoosters + ". Found cards: " + totalCards + "\n");
|
||||||
|
for (char rarity : Arrays.asList('C', 'U', 'R', 'M', 'S', 'L', 'B')) {
|
||||||
|
List<Integer> rarityCounts = resRatio.entrySet().stream()
|
||||||
|
.filter(e -> e.getKey().charAt(4) == rarity)
|
||||||
|
.map(Map.Entry::getValue)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!rarityCounts.isEmpty()) {
|
||||||
|
System.out.println(rarity + String.format(": %s unique, min %s, max %s, total %s",
|
||||||
|
rarityCounts.size(), Collections.min(rarityCounts), Collections.max(rarityCounts),
|
||||||
|
rarityCounts.stream().mapToInt(x -> x).sum()));
|
||||||
|
}
|
||||||
|
}
|
||||||
List<String> info = resRatio.entrySet().stream()
|
List<String> info = resRatio.entrySet().stream()
|
||||||
.sorted((o1, o2) -> Integer.compare(o2.getValue(), o1.getValue()))
|
.sorted((o1, o2) -> Integer.compare(o2.getValue(), o1.getValue()))
|
||||||
.map(e -> String.format("%s: %d",
|
.map(e -> String.format("%s: %d",
|
||||||
|
|
@ -535,8 +548,7 @@ public class BoosterGenerationTest extends MageTestPlayerBase {
|
||||||
e.getValue()
|
e.getValue()
|
||||||
))
|
))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
System.out.println(setToAnalyse.getName() + " - boosters opened: " + openBoosters + ". Found cards: " + totalCards + "\n"
|
System.out.println("\n" + String.join("\n", info));
|
||||||
+ String.join("\n", info));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore // debug only
|
@Ignore // debug only
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue