During drafting stop reporting basic lands as not found on stdout

This commit is contained in:
-gz
2015-01-06 00:52:13 +00:00
parent 05e43cf21c
commit aa6c7943aa
2 changed files with 16 additions and 12 deletions

View File

@@ -18,6 +18,7 @@
package forge.limited;
import forge.card.ColorSet;
import forge.card.MagicColor;
import forge.deck.Deck;
import forge.item.PaperCard;
import forge.properties.ForgePreferences;
@@ -54,6 +55,9 @@ public class BoosterDraftAI {
// roughly equivalent to 25 ranks in a core set, or 15 ranks in a small set
private static final double TAKE_BEST_THRESHOLD = 0.1;
// rank worse than any other card available to draft
private static final double RANK_UNPICKABLE = 999.0;
/**
* <p>
* Choose a CardPrinted from the list given.
@@ -121,8 +125,8 @@ public class BoosterDraftAI {
/**
* Sort cards by rank. Note that if pack has cards from different editions,
* they could have the same rank. In that (hopefully rare) case, only one
* will end up in the Map.
* they could have the same rank. Basic lands and unrecognised cards are
* rated worse than all other possible picks.
*
* @param chooseFrom
* List of cards
@@ -131,14 +135,19 @@ public class BoosterDraftAI {
private List<Pair<PaperCard, Double>> rankCards(final Iterable<PaperCard> chooseFrom) {
List<Pair<PaperCard, Double>> rankedCards = new ArrayList<Pair<PaperCard,Double>>();
for (PaperCard card : chooseFrom) {
Double rkg = DraftRankCache.getRanking(card.getName(), card.getEdition());
if (rkg != null) {
rankedCards.add(MutablePair.of(card, rkg));
Double rank;
if (MagicColor.Constant.BASIC_LANDS.contains(card.getName())) {
rank = RANK_UNPICKABLE;
} else {
rank = DraftRankCache.getRanking(card.getName(), card.getEdition());
if (rank == null) {
System.out.println("Draft Rankings - Card Not Found: " + card.getName());
rankedCards.add(MutablePair.of(card, 999.0));
rank = RANK_UNPICKABLE;
}
}
rankedCards.add(MutablePair.of(card, rank));
}
return rankedCards;
}

View File

@@ -1,7 +1,6 @@
package forge.limited;
import com.esotericsoftware.minlog.Log;
import forge.card.MagicColor;
import forge.properties.ForgeConstants;
import forge.util.FileUtil;
@@ -89,10 +88,6 @@ public class ReadDraftRankings {
public Double getRanking(String cardName, String edition) {
Double rank = null;
// Basic lands should be excluded from the evaluation --BBU
if ( MagicColor.Constant.BASIC_LANDS.contains(cardName))
return null;
if (draftRankings.containsKey(edition)) {
String safeName = cardName.replaceAll("-", " ").replaceAll("[^A-Za-z ]", "");