FotrTableDraftBoosterProducer now excludes unplayable cards to make draft more interesting and 30/30 decks more possible

This commit is contained in:
jakub.salavec
2025-03-10 11:29:17 +01:00
parent 0ae8c15573
commit c75da3b780
3 changed files with 623 additions and 14 deletions

View File

@@ -12,13 +12,11 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class FotrDraftBotsInitializer {
public class FotrDraftCardEvaluator {
private static final boolean READ_NEW_DATA = false;
private static final int RARES_IN_PACK = 1;
@@ -52,7 +50,7 @@ public class FotrDraftBotsInitializer {
private int gamesAnalyzed = 0;
public FotrDraftBotsInitializer(LotroCardBlueprintLibrary library) {
public FotrDraftCardEvaluator(LotroCardBlueprintLibrary library) {
this.library = library;
}
@@ -64,6 +62,7 @@ public class FotrDraftBotsInitializer {
Path summaryDir = Paths.get(AppConfig.getProperty("application.root"), "replay", "summaries");
System.out.println("Game history reading started at " + new SimpleDateFormat("HH.mm.ss").format(new java.util.Date()));
gamesAnalyzed = 0;
// Load FotR limited decks from the past
Map<String, Integer> winningMap = new HashMap<>();
Map<String, Integer> losingMap = new HashMap<>();
@@ -102,6 +101,72 @@ public class FotrDraftBotsInitializer {
}
}
public Map<String, Double> getPlayRateMap() {
if (!READ_NEW_DATA) {
return getCachedPlayRateMap();
} else {
// Data from solo drafts do not contain one ring cards, add some value manually after
Path summaryDir = Paths.get(AppConfig.getProperty("application.root"), "replay", "summaries");
System.out.println("Game history reading started at " + new SimpleDateFormat("HH.mm.ss").format(new java.util.Date()));
gamesAnalyzed = 0;
// Load FotR limited decks from the past
Map<String, Integer> countMap = new HashMap<>(); // How many decks contained what card (ignoring how many times it was including in said deck)
try (Stream<Path> paths = Files.walk(summaryDir)) {
paths.filter(Files::isRegularFile) // Keep only regular files
.filter(path -> path.toString().endsWith(".json")) // Filter only JSON files
.forEach(path -> countOccurrencesInGame(path, countMap)); // Process each JSON file
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Read data from " + gamesAnalyzed + " games at " + new SimpleDateFormat("HH.mm.ss").format(new java.util.Date()));
return convertCountToPlayRate(countMap);
}
}
private Map<String, Double> convertCountToPlayRate(Map<String, Integer> countMap) {
return countMap.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().doubleValue() / (gamesAnalyzed * 2))); // Every game has two decks
}
private void countOccurrencesInGame(Path path, Map<String, Integer> map) {
try {
// Read JSON file into a string
String json = Files.readString(path);
// Convert JSON to object
ReplayMetadata summary = JsonUtils.Convert(json, ReplayMetadata.class);
// Look at only limited FotR games
if (summary.GameReplayInfo != null && ("Limited - FOTR").equals(summary.GameReplayInfo.format_name) && summary.GameReplayInfo.tournament.toLowerCase().contains("draft")) {
ReplayMetadata.DeckMetadata winningDeck = summary.Decks.get(summary.GameReplayInfo.winner);
ReplayMetadata.DeckMetadata losingDeck = summary.Decks.get(summary.GameReplayInfo.loser);
if (winningDeck != null && losingDeck != null) {
gamesAnalyzed++;
map.merge(winningDeck.RingBearer.replace("*", "").replace("T", ""), 1, Integer::sum);
map.merge(winningDeck.Ring.replace("*", "").replace("T", ""), 1, Integer::sum);
Set<String> winningCardSet = new HashSet<>(winningDeck.DrawDeck);
winningCardSet.forEach(card -> map.merge(card.replace("*", "").replace("T", ""), 1, Integer::sum));
map.merge(losingDeck.RingBearer.replace("*", "").replace("T", ""), 1, Integer::sum);
map.merge(losingDeck.Ring.replace("*", "").replace("T", ""), 1, Integer::sum);
Set<String> losingCardSet = new HashSet<>(losingDeck.DrawDeck);
losingCardSet.forEach(card -> map.merge(card.replace("*", "").replace("T", ""), 1, Integer::sum));
}
}
} catch (IOException e) {
e.printStackTrace(); // Handle file reading exceptions
}
}
private Map<String, Double> convertToDoubleMap(Map<String, Integer> intMap) {
return intMap.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().doubleValue()));
}
private void countOccurrencesInDeck(Path path, Map<String, Integer> winningMap, Map<String, Integer> losingMap) {
try {
// Read JSON file into a string
@@ -777,4 +842,536 @@ public class FotrDraftBotsInitializer {
tbr.put("1_51", 0.009532713448046005);
return tbr;
}
private Map<String, Double> getCachedPlayRateMap() {
Map<String, Double> tbr = new HashMap<>();
// Missing Isildur's Bane
tbr.put("1_2", 1.0);
tbr.put("3_108", 0.9092573221757322);
tbr.put("2_51", 0.7952405857740585);
tbr.put("1_231", 0.7834728033472803);
tbr.put("3_43", 0.7311715481171548);
tbr.put("1_234", 0.7293410041841004);
tbr.put("1_112", 0.671286610878661);
tbr.put("1_365", 0.6519351464435147);
tbr.put("2_101", 0.6422594142259415);
tbr.put("3_69", 0.62918410041841);
tbr.put("2_121", 0.6192468619246861);
tbr.put("1_298", 0.6140167364016736);
tbr.put("3_63", 0.6121861924686193);
tbr.put("2_10", 0.6103556485355649);
tbr.put("1_299", 0.6103556485355649);
tbr.put("1_97", 0.6074790794979079);
tbr.put("2_114", 0.5732217573221757);
tbr.put("1_296", 0.5415794979079498);
tbr.put("3_60", 0.5363493723849372);
tbr.put("1_317", 0.5277196652719666);
tbr.put("1_290", 0.5240585774058577);
tbr.put("3_121", 0.5177824267782427);
tbr.put("1_9", 0.5143828451882845);
tbr.put("3_7", 0.49267782426778245);
tbr.put("2_37", 0.49032426778242677);
tbr.put("2_102", 0.45998953974895396);
tbr.put("2_6", 0.45083682008368203);
tbr.put("2_122", 0.44717573221757323);
tbr.put("1_270", 0.44717573221757323);
tbr.put("3_10", 0.44142259414225943);
tbr.put("2_60", 0.4408995815899582);
tbr.put("3_57", 0.4273012552301255);
tbr.put("3_74", 0.4165794979079498);
tbr.put("2_67", 0.40010460251046026);
tbr.put("2_3", 0.39984309623430964);
tbr.put("1_158", 0.3930439330543933);
tbr.put("1_311", 0.38598326359832635);
tbr.put("2_47", 0.3817991631799163);
tbr.put("3_122", 0.36872384937238495);
tbr.put("2_5", 0.36715481171548114);
tbr.put("2_44", 0.3587866108786611);
tbr.put("1_286", 0.35486401673640167);
tbr.put("2_61", 0.3543410041841004);
tbr.put("1_92", 0.35094142259414224);
tbr.put("1_364", 0.34989539748953974);
tbr.put("1_176", 0.34623430962343094);
tbr.put("3_58", 0.3457112970711297);
tbr.put("1_303", 0.337081589958159);
tbr.put("2_110", 0.33080543933054396);
tbr.put("1_178", 0.3266213389121339);
tbr.put("1_5", 0.3250523012552301);
tbr.put("3_75", 0.3182531380753138);
tbr.put("1_51", 0.314592050209205);
tbr.put("1_145", 0.310407949790795);
tbr.put("2_48", 0.3064853556485356);
tbr.put("1_150", 0.30465481171548114);
tbr.put("1_56", 0.2975941422594142);
tbr.put("1_152", 0.29131799163179917);
tbr.put("3_62", 0.2907949790794979);
tbr.put("2_29", 0.2889644351464435);
tbr.put("1_133", 0.28556485355648537);
tbr.put("1_57", 0.2698744769874477);
tbr.put("1_154", 0.2651673640167364);
tbr.put("3_106", 0.25732217573221755);
tbr.put("1_156", 0.2513075313807531);
tbr.put("2_108", 0.24398535564853557);
tbr.put("2_18", 0.24372384937238495);
tbr.put("2_4", 0.24320083682008367);
tbr.put("2_82", 0.24215481171548117);
tbr.put("3_96", 0.24215481171548117);
tbr.put("1_196", 0.23718619246861924);
tbr.put("1_27", 0.23718619246861924);
tbr.put("3_38", 0.2337866108786611);
tbr.put("1_262", 0.2319560669456067);
tbr.put("2_89", 0.2301255230125523);
tbr.put("1_48", 0.22698744769874477);
tbr.put("1_146", 0.2243723849372385);
tbr.put("1_11", 0.2225418410041841);
tbr.put("1_267", 0.22097280334728034);
tbr.put("3_59", 0.2157426778242678);
tbr.put("3_61", 0.21338912133891214);
tbr.put("1_37", 0.21208158995815898);
tbr.put("3_35", 0.20972803347280336);
tbr.put("1_26", 0.20868200836820083);
tbr.put("2_64", 0.20763598326359833);
tbr.put("2_32", 0.20240585774058578);
tbr.put("2_14", 0.17730125523012552);
tbr.put("3_12", 0.17625523012552302);
tbr.put("2_83", 0.1759937238493724);
tbr.put("1_271", 0.17547071129707112);
tbr.put("1_102", 0.16684100418410042);
tbr.put("1_281", 0.16265690376569036);
tbr.put("1_138", 0.16030334728033474);
tbr.put("3_13", 0.15978033472803346);
tbr.put("1_121", 0.15847280334728034);
tbr.put("2_93", 0.15821129707112971);
tbr.put("3_30", 0.15664225941422594);
tbr.put("3_111", 0.15664225941422594);
tbr.put("2_84", 0.1550732217573222);
tbr.put("2_85", 0.1545502092050209);
tbr.put("1_180", 0.1545502092050209);
tbr.put("1_179", 0.14905857740585773);
tbr.put("1_191", 0.1487970711297071);
tbr.put("3_68", 0.1477510460251046);
tbr.put("1_187", 0.14748953974895398);
tbr.put("1_3", 0.1448744769874477);
tbr.put("3_25", 0.14382845188284518);
tbr.put("2_90", 0.1430439330543933);
tbr.put("3_65", 0.14252092050209206);
tbr.put("2_105", 0.14069037656903766);
tbr.put("1_184", 0.14042887029288703);
tbr.put("3_5", 0.13885983263598325);
tbr.put("3_56", 0.1325836820083682);
tbr.put("1_153", 0.13232217573221758);
tbr.put("3_64", 0.12526150627615062);
tbr.put("3_49", 0.12421548117154811);
tbr.put("1_117", 0.12421548117154811);
tbr.put("1_94", 0.12369246861924686);
tbr.put("1_31", 0.12264644351464435);
tbr.put("1_44", 0.1221234309623431);
tbr.put("2_46", 0.12055439330543934);
tbr.put("1_283", 0.12055439330543934);
tbr.put("2_62", 0.11950836820083682);
tbr.put("1_162", 0.11950836820083682);
tbr.put("3_21", 0.11793933054393306);
tbr.put("2_88", 0.11793933054393306);
tbr.put("3_42", 0.11584728033472803);
tbr.put("3_66", 0.11532426778242678);
tbr.put("3_80", 0.11532426778242678);
tbr.put("1_151", 0.11506276150627615);
tbr.put("1_12", 0.1145397489539749);
tbr.put("1_78", 0.1145397489539749);
tbr.put("3_67", 0.11375523012552301);
tbr.put("2_104", 0.11192468619246862);
tbr.put("2_96", 0.111663179916318);
tbr.put("1_268", 0.11140167364016737);
tbr.put("1_90", 0.10957112970711297);
tbr.put("1_177", 0.10852510460251046);
tbr.put("1_41", 0.1080020920502092);
tbr.put("1_50", 0.10774058577405858);
tbr.put("3_20", 0.10695606694560669);
tbr.put("2_71", 0.10434100418410042);
tbr.put("1_313", 0.1032949790794979);
tbr.put("1_32", 0.10251046025104603);
tbr.put("1_108", 0.10251046025104603);
tbr.put("1_116", 0.1022489539748954);
tbr.put("3_31", 0.10198744769874477);
tbr.put("2_22", 0.09832635983263599);
tbr.put("1_49", 0.09492677824267783);
tbr.put("3_14", 0.09440376569037658);
tbr.put("1_159", 0.09361924686192469);
tbr.put("1_95", 0.09178870292887029);
tbr.put("1_89", 0.09152719665271966);
tbr.put("1_14", 0.09074267782426779);
tbr.put("2_49", 0.09074267782426779);
tbr.put("1_233", 0.09074267782426779);
tbr.put("1_280", 0.09021966527196652);
tbr.put("1_185", 0.08891213389121339);
tbr.put("2_95", 0.08865062761506276);
tbr.put("1_6", 0.08734309623430962);
tbr.put("3_98", 0.08551255230125523);
tbr.put("1_136", 0.08472803347280335);
tbr.put("3_55", 0.08106694560669456);
tbr.put("3_71", 0.08028242677824268);
tbr.put("1_127", 0.08028242677824268);
tbr.put("1_84", 0.07897489539748954);
tbr.put("3_41", 0.07897489539748954);
tbr.put("2_20", 0.07792887029288703);
tbr.put("2_52", 0.0776673640167364);
tbr.put("3_94", 0.0776673640167364);
tbr.put("1_230", 0.07740585774058577);
tbr.put("2_2", 0.07714435146443514);
tbr.put("2_16", 0.07635983263598327);
tbr.put("1_209", 0.07635983263598327);
tbr.put("2_42", 0.07557531380753138);
tbr.put("1_7", 0.07505230125523013);
tbr.put("1_165", 0.07479079497907949);
tbr.put("1_261", 0.07479079497907949);
tbr.put("1_308", 0.07322175732217573);
tbr.put("2_75", 0.07191422594142259);
tbr.put("1_139", 0.06956066945606694);
tbr.put("1_236", 0.06903765690376569);
tbr.put("1_40", 0.06877615062761507);
tbr.put("1_59", 0.06851464435146444);
tbr.put("1_30", 0.0682531380753138);
tbr.put("1_76", 0.06746861924686193);
tbr.put("2_76", 0.0672071129707113);
tbr.put("1_75", 0.06616108786610879);
tbr.put("1_229", 0.06511506276150628);
tbr.put("1_68", 0.06354602510460251);
tbr.put("2_50", 0.06354602510460251);
tbr.put("1_302", 0.06354602510460251);
tbr.put("1_131", 0.06354602510460251);
tbr.put("1_237", 0.06354602510460251);
tbr.put("1_207", 0.062238493723849375);
tbr.put("1_160", 0.062238493723849375);
tbr.put("2_59", 0.06145397489539749);
tbr.put("3_100", 0.06040794979079498);
tbr.put("2_92", 0.05910041841004184);
tbr.put("1_19", 0.058577405857740586);
tbr.put("1_182", 0.05674686192468619);
tbr.put("1_47", 0.05543933054393305);
tbr.put("1_250", 0.05465481171548117);
tbr.put("1_72", 0.053347280334728034);
tbr.put("1_103", 0.05099372384937238);
tbr.put("1_13", 0.0502092050209205);
tbr.put("2_63", 0.04942468619246862);
tbr.put("3_28", 0.049163179916317995);
tbr.put("3_34", 0.049163179916317995);
tbr.put("3_78", 0.04890167364016736);
tbr.put("1_181", 0.04811715481171548);
tbr.put("1_269", 0.04811715481171548);
tbr.put("1_255", 0.04785564853556486);
tbr.put("1_218", 0.04654811715481171);
tbr.put("1_143", 0.04628661087866109);
tbr.put("3_1", 0.045240585774058574);
tbr.put("1_114", 0.044717573221757324);
tbr.put("3_17", 0.04445606694560669);
tbr.put("1_260", 0.04419456066945607);
tbr.put("3_82", 0.043933054393305436);
tbr.put("1_8", 0.04367154811715481);
tbr.put("1_125", 0.04367154811715481);
tbr.put("1_183", 0.04210251046025105);
tbr.put("1_101", 0.04157949790794979);
tbr.put("2_106", 0.041056485355648535);
tbr.put("3_95", 0.04001046025104602);
tbr.put("3_101", 0.0397489539748954);
tbr.put("1_45", 0.03922594142259414);
tbr.put("3_114", 0.03922594142259414);
tbr.put("2_7", 0.03922594142259414);
tbr.put("1_73", 0.038179916317991634);
tbr.put("3_6", 0.038179916317991634);
tbr.put("1_240", 0.037918410041841);
tbr.put("1_15", 0.03765690376569038);
tbr.put("2_103", 0.03765690376569038);
tbr.put("1_173", 0.03634937238493724);
tbr.put("3_97", 0.03608786610878661);
tbr.put("2_74", 0.03582635983263598);
tbr.put("1_16", 0.03556485355648536);
tbr.put("2_12", 0.03556485355648536);
tbr.put("3_86", 0.03556485355648536);
tbr.put("3_18", 0.035303347280334726);
tbr.put("1_246", 0.035303347280334726);
tbr.put("1_264", 0.0350418410041841);
tbr.put("1_258", 0.034518828451882845);
tbr.put("2_69", 0.033734309623430964);
tbr.put("3_8", 0.033734309623430964);
tbr.put("1_164", 0.033734309623430964);
tbr.put("1_235", 0.033734309623430964);
tbr.put("1_316", 0.03321129707112971);
tbr.put("2_38", 0.03294979079497908);
tbr.put("1_142", 0.03190376569037657);
tbr.put("1_96", 0.031642259414225944);
tbr.put("3_50", 0.03138075313807531);
tbr.put("1_128", 0.03138075313807531);
tbr.put("1_148", 0.031119246861924688);
tbr.put("3_29", 0.03085774058577406);
tbr.put("1_161", 0.03085774058577406);
tbr.put("1_256", 0.03085774058577406);
tbr.put("2_112", 0.03059623430962343);
tbr.put("1_188", 0.030334728033472803);
tbr.put("1_257", 0.02981171548117155);
tbr.put("1_304", 0.02955020920502092);
tbr.put("1_175", 0.02955020920502092);
tbr.put("2_54", 0.029288702928870293);
tbr.put("1_33", 0.029027196652719665);
tbr.put("3_39", 0.028242677824267783);
tbr.put("2_65", 0.028242677824267783);
tbr.put("3_40", 0.028242677824267783);
tbr.put("1_83", 0.026935146443514645);
tbr.put("3_112", 0.02641213389121339);
tbr.put("2_28", 0.02615062761506276);
tbr.put("3_79", 0.02615062761506276);
tbr.put("3_37", 0.025889121338912136);
tbr.put("2_55", 0.025627615062761507);
tbr.put("3_76", 0.02536610878661088);
tbr.put("1_289", 0.024843096234309622);
tbr.put("1_248", 0.024581589958158997);
tbr.put("2_41", 0.02432008368200837);
tbr.put("3_85", 0.02432008368200837);
tbr.put("1_106", 0.02405857740585774);
tbr.put("3_104", 0.023797071129707113);
tbr.put("1_157", 0.023535564853556484);
tbr.put("1_201", 0.02301255230125523);
tbr.put("1_119", 0.02301255230125523);
tbr.put("2_8", 0.022751046025104603);
tbr.put("2_13", 0.022228033472803346);
tbr.put("3_70", 0.022228033472803346);
tbr.put("3_93", 0.022228033472803346);
tbr.put("3_32", 0.021966527196652718);
tbr.put("2_87", 0.021182008368200837);
tbr.put("1_220", 0.021182008368200837);
tbr.put("1_42", 0.02092050209205021);
tbr.put("1_69", 0.02092050209205021);
tbr.put("3_24", 0.02092050209205021);
tbr.put("1_309", 0.02092050209205021);
tbr.put("1_4", 0.020397489539748955);
tbr.put("1_107", 0.020135983263598327);
tbr.put("1_174", 0.020135983263598327);
tbr.put("3_77", 0.0198744769874477);
tbr.put("2_39", 0.019089958158995817);
tbr.put("3_27", 0.01856694560669456);
tbr.put("2_94", 0.01856694560669456);
tbr.put("2_100", 0.018305439330543932);
tbr.put("3_99", 0.018043933054393304);
tbr.put("1_197", 0.01778242677824268);
tbr.put("1_277", 0.01778242677824268);
tbr.put("1_272", 0.01778242677824268);
tbr.put("1_223", 0.01752092050209205);
tbr.put("2_72", 0.017259414225941423);
tbr.put("1_293", 0.017259414225941423);
tbr.put("1_98", 0.016997907949790794);
tbr.put("1_168", 0.016997907949790794);
tbr.put("1_244", 0.016736401673640166);
tbr.put("3_53", 0.01647489539748954);
tbr.put("1_126", 0.01647489539748954);
tbr.put("2_26", 0.016213389121338913);
tbr.put("2_30", 0.016213389121338913);
tbr.put("3_102", 0.015951882845188285);
tbr.put("1_38", 0.015951882845188285);
tbr.put("1_163", 0.015690376569037656);
tbr.put("2_99", 0.01542887029288703);
tbr.put("1_226", 0.015167364016736401);
tbr.put("1_195", 0.015167364016736401);
tbr.put("2_68", 0.014905857740585775);
tbr.put("1_34", 0.014644351464435146);
tbr.put("2_56", 0.014644351464435146);
tbr.put("3_73", 0.014644351464435146);
tbr.put("1_149", 0.014644351464435146);
tbr.put("1_24", 0.014382845188284518);
tbr.put("3_22", 0.014382845188284518);
tbr.put("1_279", 0.014382845188284518);
tbr.put("1_21", 0.014121338912133892);
tbr.put("2_35", 0.014121338912133892);
tbr.put("1_147", 0.013598326359832637);
tbr.put("1_36", 0.013336820083682008);
tbr.put("1_65", 0.013336820083682008);
tbr.put("1_190", 0.013336820083682008);
tbr.put("2_21", 0.01307531380753138);
tbr.put("1_62", 0.01307531380753138);
tbr.put("1_266", 0.01307531380753138);
tbr.put("3_33", 0.012552301255230125);
tbr.put("1_66", 0.012290794979079499);
tbr.put("3_87", 0.012290794979079499);
tbr.put("3_91", 0.01202928870292887);
tbr.put("1_278", 0.01202928870292887);
tbr.put("2_9", 0.01202928870292887);
tbr.put("2_40", 0.011767782426778242);
tbr.put("1_217", 0.011767782426778242);
tbr.put("1_227", 0.011767782426778242);
tbr.put("3_89", 0.011767782426778242);
tbr.put("1_192", 0.011244769874476987);
tbr.put("1_141", 0.011244769874476987);
tbr.put("1_120", 0.011244769874476987);
tbr.put("3_84", 0.010983263598326359);
tbr.put("1_213", 0.010721757322175732);
tbr.put("1_113", 0.010721757322175732);
tbr.put("2_1", 0.010460251046025104);
tbr.put("2_78", 0.00993723849372385);
tbr.put("1_17", 0.009675732217573221);
tbr.put("1_194", 0.009675732217573221);
tbr.put("3_48", 0.009414225941422594);
tbr.put("3_52", 0.009414225941422594);
tbr.put("2_98", 0.009414225941422594);
tbr.put("1_186", 0.009414225941422594);
tbr.put("3_19", 0.009152719665271966);
tbr.put("1_87", 0.009152719665271966);
tbr.put("1_259", 0.009152719665271966);
tbr.put("1_199", 0.00889121338912134);
tbr.put("1_263", 0.00889121338912134);
tbr.put("1_63", 0.008629707112970711);
tbr.put("3_11", 0.008629707112970711);
tbr.put("1_58", 0.008368200836820083);
tbr.put("2_33", 0.008368200836820083);
tbr.put("1_193", 0.008368200836820083);
tbr.put("1_155", 0.008368200836820083);
tbr.put("1_123", 0.008368200836820083);
tbr.put("3_109", 0.008106694560669456);
tbr.put("3_26", 0.008106694560669456);
tbr.put("1_306", 0.008106694560669456);
tbr.put("1_297", 0.008106694560669456);
tbr.put("1_109", 0.007845188284518828);
tbr.put("2_107", 0.007845188284518828);
tbr.put("1_104", 0.007583682008368201);
tbr.put("1_132", 0.007583682008368201);
tbr.put("1_247", 0.007583682008368201);
tbr.put("1_198", 0.007322175732217573);
tbr.put("2_23", 0.007322175732217573);
tbr.put("3_92", 0.007322175732217573);
tbr.put("1_135", 0.007322175732217573);
tbr.put("2_15", 0.007060669456066946);
tbr.put("1_67", 0.007060669456066946);
tbr.put("2_43", 0.007060669456066946);
tbr.put("1_251", 0.007060669456066946);
tbr.put("1_110", 0.007060669456066946);
tbr.put("1_129", 0.007060669456066946);
tbr.put("1_29", 0.006799163179916318);
tbr.put("3_81", 0.006799163179916318);
tbr.put("1_288", 0.006799163179916318);
tbr.put("1_284", 0.006799163179916318);
tbr.put("1_43", 0.00653765690376569);
tbr.put("1_105", 0.00653765690376569);
tbr.put("1_202", 0.00653765690376569);
tbr.put("3_90", 0.00653765690376569);
tbr.put("1_291", 0.00653765690376569);
tbr.put("2_80", 0.006014644351464435);
tbr.put("1_318", 0.006014644351464435);
tbr.put("1_208", 0.006014644351464435);
tbr.put("1_204", 0.006014644351464435);
tbr.put("1_134", 0.006014644351464435);
tbr.put("2_31", 0.005753138075313808);
tbr.put("1_282", 0.005753138075313808);
tbr.put("1_219", 0.0054916317991631795);
tbr.put("1_274", 0.0054916317991631795);
tbr.put("1_294", 0.0054916317991631795);
tbr.put("1_118", 0.0054916317991631795);
tbr.put("1_232", 0.004968619246861925);
tbr.put("3_45", 0.004707112970711297);
tbr.put("1_224", 0.004707112970711297);
tbr.put("1_171", 0.004707112970711297);
tbr.put("3_16", 0.00444560669456067);
tbr.put("1_172", 0.00444560669456067);
tbr.put("1_64", 0.0041841004184100415);
tbr.put("1_70", 0.0041841004184100415);
tbr.put("1_80", 0.0041841004184100415);
tbr.put("1_85", 0.0041841004184100415);
tbr.put("2_79", 0.0041841004184100415);
tbr.put("2_91", 0.0041841004184100415);
tbr.put("1_205", 0.0041841004184100415);
tbr.put("3_72", 0.0041841004184100415);
tbr.put("1_228", 0.003922594142259414);
tbr.put("1_275", 0.003922594142259414);
tbr.put("1_253", 0.003922594142259414);
tbr.put("2_81", 0.0036610878661087866);
tbr.put("2_111", 0.0036610878661087866);
tbr.put("2_19", 0.003399581589958159);
tbr.put("3_54", 0.003399581589958159);
tbr.put("1_307", 0.003399581589958159);
tbr.put("1_238", 0.003399581589958159);
tbr.put("1_245", 0.003399581589958159);
tbr.put("2_11", 0.0031380753138075313);
tbr.put("1_79", 0.0031380753138075313);
tbr.put("2_53", 0.0031380753138075313);
tbr.put("3_36", 0.0031380753138075313);
tbr.put("3_44", 0.0031380753138075313);
tbr.put("3_47", 0.0031380753138075313);
tbr.put("2_70", 0.0031380753138075313);
tbr.put("2_109", 0.0031380753138075313);
tbr.put("2_27", 0.002876569037656904);
tbr.put("1_53", 0.002876569037656904);
tbr.put("3_4", 0.002876569037656904);
tbr.put("1_239", 0.002876569037656904);
tbr.put("1_122", 0.002876569037656904);
tbr.put("1_39", 0.002615062761506276);
tbr.put("1_216", 0.002615062761506276);
tbr.put("1_214", 0.002615062761506276);
tbr.put("1_212", 0.002615062761506276);
tbr.put("1_314", 0.002615062761506276);
tbr.put("1_301", 0.002615062761506276);
tbr.put("1_60", 0.0023535564853556486);
tbr.put("3_83", 0.0023535564853556486);
tbr.put("1_170", 0.0023535564853556486);
tbr.put("1_46", 0.0020920502092050207);
tbr.put("2_34", 0.0020920502092050207);
tbr.put("3_46", 0.0020920502092050207);
tbr.put("1_210", 0.0020920502092050207);
tbr.put("1_221", 0.0020920502092050207);
tbr.put("2_97", 0.0020920502092050207);
tbr.put("1_315", 0.0020920502092050207);
tbr.put("1_276", 0.0020920502092050207);
tbr.put("1_25", 0.0018305439330543933);
tbr.put("3_107", 0.0018305439330543933);
tbr.put("1_71", 0.0018305439330543933);
tbr.put("1_86", 0.0018305439330543933);
tbr.put("3_88", 0.0018305439330543933);
tbr.put("1_305", 0.0018305439330543933);
tbr.put("3_3", 0.0018305439330543933);
tbr.put("1_249", 0.0018305439330543933);
tbr.put("1_124", 0.0018305439330543933);
tbr.put("2_58", 0.0015690376569037657);
tbr.put("2_57", 0.0015690376569037657);
tbr.put("3_51", 0.0015690376569037657);
tbr.put("1_200", 0.0015690376569037657);
tbr.put("1_166", 0.0015690376569037657);
tbr.put("2_124", 0.001307531380753138);
tbr.put("2_113", 0.001307531380753138);
tbr.put("1_23", 0.0010460251046025104);
tbr.put("2_24", 0.0010460251046025104);
tbr.put("2_36", 0.0010460251046025104);
tbr.put("1_61", 0.0010460251046025104);
tbr.put("1_74", 0.0010460251046025104);
tbr.put("1_82", 0.0010460251046025104);
tbr.put("1_91", 0.0010460251046025104);
tbr.put("1_211", 0.0010460251046025104);
tbr.put("3_2", 0.0010460251046025104);
tbr.put("1_375", 0.0010460251046025104);
tbr.put("1_20", 7.845188284518828E-4);
tbr.put("1_77", 7.845188284518828E-4);
tbr.put("2_73", 7.845188284518828E-4);
tbr.put("1_167", 7.845188284518828E-4);
tbr.put("1_285", 7.845188284518828E-4);
tbr.put("1_115", 7.845188284518828E-4);
tbr.put("3_23", 5.230125523012552E-4);
tbr.put("1_93", 5.230125523012552E-4);
tbr.put("1_100", 5.230125523012552E-4);
tbr.put("1_310", 5.230125523012552E-4);
tbr.put("1_300", 5.230125523012552E-4);
tbr.put("3_110", 5.230125523012552E-4);
tbr.put("1_377", 5.230125523012552E-4);
tbr.put("1_370", 5.230125523012552E-4);
tbr.put("1_18", 2.615062761506276E-4);
tbr.put("1_10", 2.615062761506276E-4);
tbr.put("1_28", 2.615062761506276E-4);
tbr.put("1_35", 2.615062761506276E-4);
tbr.put("2_17", 2.615062761506276E-4);
tbr.put("1_55", 2.615062761506276E-4);
tbr.put("1_54", 2.615062761506276E-4);
tbr.put("2_45", 2.615062761506276E-4);
tbr.put("1_312", 2.615062761506276E-4);
tbr.put("1_273", 2.615062761506276E-4);
tbr.put("1_292", 2.615062761506276E-4);
tbr.put("1_169", 2.615062761506276E-4);
tbr.put("1_378", 2.615062761506276E-4);
tbr.put("1_252", 2.615062761506276E-4);
tbr.put("1_111", 2.615062761506276E-4);
tbr.put("1_243", 2.615062761506276E-4);
return tbr;
}
}

View File

@@ -9,7 +9,6 @@ import com.gempukku.lotro.game.SortAndFilterCards;
import com.gempukku.lotro.game.formats.LotroFormatLibrary;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class FotrTableDraftBoosterProducer implements BoosterProducer {
@@ -27,7 +26,7 @@ public class FotrTableDraftBoosterProducer implements BoosterProducer {
private final Map<String, List<String>> cardPools = new HashMap<>();
public FotrTableDraftBoosterProducer(CollectionsManager collectionsManager, LotroCardBlueprintLibrary cardLibrary,
LotroFormatLibrary formatLibrary) {
LotroFormatLibrary formatLibrary, Map<String, Double> cardPlayRates) {
SortAndFilterCards sortAndFilterCards = new SortAndFilterCards();
List<String> rarities = List.of("rare", "uncommon", "common");
@@ -63,6 +62,17 @@ public class FotrTableDraftBoosterProducer implements BoosterProducer {
}
}
}
// Remove bad cards from pools to make boosters better
cardPools.forEach((key, value) -> {
if (key.startsWith("common") || key.startsWith("uncommon")) {
value.removeIf(cardId -> !cardPlayRates.containsKey(cardId) || cardPlayRates.get(cardId) < 0.01); // (Un)common has really low play rate
}
if (key.startsWith("rare")) {
value.removeIf(cardId -> !cardPlayRates.containsKey(cardId)); // Rare was never played
}
});
// Add the rare ring to draft manually - it is neither fp nor shadow card
cardPools.get("rare-fotr-fp").add("1_1");
}

View File

@@ -9,23 +9,22 @@ import com.gempukku.lotro.game.CardNotFoundException;
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
import com.gempukku.lotro.game.formats.LotroFormatLibrary;
import java.util.HashMap;
import java.util.Map;
public class FotrTableDraftDefinition implements TableDraftDefinition {
private static final int DRAFT_ROUNDS = 6;
private static final int PLAYER_COUNT = 6;
private static Map<String, Double> cardValuesForBots = new HashMap<>();
private final StartingCollectionProducer startingCollectionProducer;
private final BoosterProducer boosterProducer;
private final Map<String, Double> cardValues;
public FotrTableDraftDefinition(CollectionsManager collectionsManager, LotroCardBlueprintLibrary cardLibrary,
LotroFormatLibrary formatLibrary) {
startingCollectionProducer = new FotrTableDraftStartingCollectionProducer(collectionsManager, cardLibrary, formatLibrary);
boosterProducer = new FotrTableDraftBoosterProducer(collectionsManager, cardLibrary, formatLibrary);
cardValuesForBots = new FotrDraftBotsInitializer(cardLibrary).getValuesMap();
FotrDraftCardEvaluator evaluator = new FotrDraftCardEvaluator(cardLibrary);
cardValues = evaluator.getValuesMap();
Map<String, Double> cardPlayRates = evaluator.getPlayRateMap();
// Print the card values for manual check
// cardValuesForBots.entrySet()
// .stream()
@@ -44,12 +43,15 @@ public class FotrTableDraftDefinition implements TableDraftDefinition {
// .forEach(entry -> {
// System.out.println("tbr.put(\"" + entry.getKey() + "\", " + entry.getValue() + ");");
// });
startingCollectionProducer = new FotrTableDraftStartingCollectionProducer(collectionsManager, cardLibrary, formatLibrary);
boosterProducer = new FotrTableDraftBoosterProducer(collectionsManager, cardLibrary, formatLibrary, cardPlayRates);
}
@Override
public TableDraft getTableDraft(CollectionsManager collectionsManager, CollectionType collectionType, DraftTimerProducer draftTimerProducer) {
DraftTimer draftTimer = draftTimerProducer == null ? null : draftTimerProducer.getDraftTimer();
return new TableDraftClassic(collectionsManager, collectionType, startingCollectionProducer, boosterProducer, PLAYER_COUNT, DRAFT_ROUNDS, draftTimer, cardValuesForBots);
return new TableDraftClassic(collectionsManager, collectionType, startingCollectionProducer, boosterProducer, PLAYER_COUNT, DRAFT_ROUNDS, draftTimer, cardValues);
}
@Override