public void CreateLookup(FootprintCollection footprints) { const int maxLookupIndex = 1953125; // 5^9 var orLookup = new long[maxLookupIndex]; var waitShiftLookup = new long[maxLookupIndex]; var language = CreateAnalyzedWords(); var groupedByHash = language.GroupBy(w => w.Base5Hash); var arrangementGroups = groupedByHash.Select(g => new ArrangementGroup(g)).ToList(); foreach (var arrangementGroup in arrangementGroups) { var footprintCreator = new FuFootprintCreator(arrangementGroup); var footprintIndex = footprints.IndexOf(footprintCreator.Footprint); var base5Hash = arrangementGroup.Base5Hash; var field = new SuitScoringBitField(arrangementGroup, footprintIndex); Debug.Assert(orLookup[base5Hash] == 0 || orLookup[base5Hash] == field.OrValue); orLookup[base5Hash] = field.OrValue; Debug.Assert(waitShiftLookup[base5Hash] == 0 || waitShiftLookup[base5Hash] == field.WaitShiftValue); waitShiftLookup[base5Hash] = field.WaitShiftValue; } Write("SuitOrLookup.dat", orLookup); Write("SuitWaitShiftLookup.dat", waitShiftLookup); }
public static void Create(string directory) { var footprints = new FootprintCollection(); var a = new SuitScoringInformationCreator(directory); a.CreateLookup(footprints); footprints.Serialize(Path.Combine(directory, "SuitFu.dat")); var c = new HonorScoringInformationCreator(directory); c.CreateLookup(); }