Improved deck naming for LDA generated decks

This commit is contained in:
austinio7116
2018-06-11 06:53:32 +01:00
committed by maustin
parent 6d24ddc8e6
commit 75931881f7
4 changed files with 28 additions and 2 deletions

View File

@@ -296,6 +296,7 @@ public class DeckgenUtil {
return deck;
}
/**
* @param selection {@link java.lang.String} array
* @return {@link forge.deck.Deck}

View File

@@ -7,6 +7,8 @@ import java.util.List;
public class Archetype implements Serializable {
static final long serialVersionUID = 1733769383530140352L;
private List<Pair<String, Double>> cardProbabilities;
private String name;
private Integer deckCount;
@@ -26,7 +28,10 @@ public class Archetype implements Serializable {
}
public String getName() {
return name;
return titleize(name);
/*//Debug:
return getDeckCount() + "-" + getCardProbabilities().get(0).getRight().toString().substring(0,4)
+ "-" + titleize(name) + "-" + getCardProbabilities().get(0).getLeft();*/
}
public void setName(String name) {
@@ -40,4 +45,19 @@ public class Archetype implements Serializable {
public void setDeckCount(Integer deckCount) {
this.deckCount = deckCount;
}
public static String titleize(final String input) {
final StringBuilder output = new StringBuilder(input.length());
boolean lastCharacterWasWhitespace = true;
for (final char currentCharacter : input.toCharArray()) {
if (lastCharacterWasWhitespace) {
output.append(Character.toTitleCase(currentCharacter));
} else {
output.append(currentCharacter);
}
lastCharacterWasWhitespace = Character.isWhitespace(currentCharacter);
}
return output.toString();
}
}

View File

@@ -22,7 +22,9 @@ public class ArchetypeDeckBuilder extends CardThemedDeckBuilder{
* @return name
*/
protected String generateName() {
return archetype.getName() + " generated deck";
return archetype.getName() + " Generated Deck";
}
}

View File

@@ -105,6 +105,9 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
}
//get colours for first few cards
for(PaperCard c:getAiPlayables()){
if(c.getRules().getType().isLand()){
continue;
}
if(deckColors.canChoseMoreColors()){
deckColors.addColorsOf(c);
cardCount++;