aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2015-07-12 21:00:53 +0200
committerEduardo Pedroni <ep625@york.ac.uk>2015-07-12 21:00:53 +0200
commit7d3f8acf5260bf0d5458d258111e05a05859e535 (patch)
tree5e4f4591db0fbeec0fc55352bc416d60b55f9176 /test
parentdab875c97790cc482b9a74ad0339b71ff0aab509 (diff)
Started fiddling with decks
Diffstat (limited to 'test')
-rw-r--r--test/Testest.java50
1 files changed, 17 insertions, 33 deletions
diff --git a/test/Testest.java b/test/Testest.java
index 016cbf4..7128b75 100644
--- a/test/Testest.java
+++ b/test/Testest.java
@@ -1,54 +1,38 @@
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
-import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
+import eu.equalparts.cardbase.Cardbase;
import eu.equalparts.cardbase.data.Card;
+import eu.equalparts.cardbase.data.StandaloneDeck;
import eu.equalparts.cardbase.utils.JSON;
public class Testest {
-
-
- public static class FullCardSet {
-
- public String name;
- public String code;
- public String magicCardsInfoCode;
- public String releaseDate;
- public String border;
- public String type;
- public String block;
- public String gathererCode;
- public List<Card> cards;
-
- public FullCardSet() {}
- }
-
public static void main(String... args) throws JsonParseException, JsonMappingException, MalformedURLException, IOException {
- Map<String, FullCardSet> setMap = JSON.mapper.readValue(new File("./AllSets.json"), new TypeReference<Map<String, FullCardSet>> () {});
-
- List<String> rarities = new ArrayList<String>();
+ StandaloneDeck deck = JSON.mapper.readValue(new File("control.cbd"), StandaloneDeck.class);
- int count = 0;
+ System.out.println(deck.name);
+ System.out.println("plains: " + deck.plains);
+ System.out.println("islands: " + deck.islands);
+ System.out.println("swamps: " + deck.swamps);
+ System.out.println("mountains: " + deck.mountains);
+ System.out.println("forests: " + deck.forests);
- for (FullCardSet cardSet : setMap.values()) {
- for (Card card : cardSet.cards) {
- count++;
- if (!rarities.contains(card.rarity)) {
- rarities.add(card.rarity);
- System.out.println(card.rarity);
- }
- }
+ for (Card card : deck.cards) {
+ System.out.println(card.count + "x " + card.name);
}
- System.out.println("Done, " + count + " cards looked at.");
+ Cardbase cards = new Cardbase(new File("cards.cb"));
+ List<Card> missingCards = cards.getMissingCards(deck);
+
+ for (Card card : missingCards) {
+ System.out.println(card.count + "x " + card.name);
+ }
}
}