public RandomElementFactory(ICharacterGenerator characterGenerator, int geneCount, int chromsomeCount, FitnessCalculator fitnessCalculator) { this.characterGenerator = characterGenerator; this.fitnessCalculator = fitnessCalculator; GeneCount = geneCount; ChromosomeCount = chromsomeCount; }
public PuzzleBoardGenerator( ICharacterGenerator characterGenerator, IGenerator <IList <PuzzleWord> > puzzleWordGenerator, IOptions <PuzzleBoardGeneratorOptions> options, ILogger <PuzzleBoardGenerator> logger) { CharacterGenerator = characterGenerator; PuzzleWordGenerator = puzzleWordGenerator; Options = options.Value; Logger = logger; }
public EncounterCharacterGenerator(ICharacterGenerator characterGenerator, IAlignmentRandomizer alignmentRandomizer, IClassNameRandomizer anyPlayerClassNameRandomizer, ISetLevelRandomizer setLevelRandomizer, RaceRandomizer baseRaceRandomizer, RaceRandomizer metaraceRandomizer, IStatsRandomizer statsRandomizer, ICollectionSelector collectionSelector, ISetMetaraceRandomizer setMetaraceRandomizer, IClassNameRandomizer anyNPCClassNameRandomizer, ISetClassNameRandomizer setClassNameRandomizer, Dice dice) { this.characterGenerator = characterGenerator; this.alignmentRandomizer = alignmentRandomizer; this.anyPlayerClassNameRandomizer = anyPlayerClassNameRandomizer; this.setLevelRandomizer = setLevelRandomizer; this.baseRaceRandomizer = baseRaceRandomizer; this.metaraceRandomizer = metaraceRandomizer; this.statsRandomizer = statsRandomizer; this.collectionSelector = collectionSelector; this.setMetaraceRandomizer = setMetaraceRandomizer; this.anyNPCClassNameRandomizer = anyNPCClassNameRandomizer; this.setClassNameRandomizer = setClassNameRandomizer; this.dice = dice; challengeRatingRegex = new Regex(RegexConstants.ChallengeRatingPattern); setCharacterLevelRegex = new Regex(RegexConstants.SetCharacterLevelPattern); subTypeRegex = new Regex(RegexConstants.DescriptionPattern); }
public LeadershipGenerator(ICharacterGenerator characterGenerator, ILeadershipSelector leadershipSelector, IPercentileSelector percentileSelector, IAdjustmentsSelector adjustmentsSelector, ISetLevelRandomizer setLevelRandomizer, ISetAlignmentRandomizer setAlignmentRandomizer, IAlignmentRandomizer anyAlignmentRandomizer, IClassNameRandomizer anyPlayerClassNameRandomizer, RaceRandomizer anyBaseRaceRandomizer, RaceRandomizer anyMetaraceRandomizer, IStatsRandomizer rawStatsRandomizer, IBooleanPercentileSelector booleanPercentileSelector, ICollectionsSelector collectionsSelector, IAlignmentGenerator alignmentGenerator, Generator generator, IClassNameRandomizer anyNPCClassNameRandomizer) { this.characterGenerator = characterGenerator; this.leadershipSelector = leadershipSelector; this.percentileSelector = percentileSelector; this.adjustmentsSelector = adjustmentsSelector; this.setLevelRandomizer = setLevelRandomizer; this.setAlignmentRandomizer = setAlignmentRandomizer; this.anyAlignmentRandomizer = anyAlignmentRandomizer; this.anyPlayerClassNameRandomizer = anyPlayerClassNameRandomizer; this.anyBaseRaceRandomizer = anyBaseRaceRandomizer; this.anyMetaraceRandomizer = anyMetaraceRandomizer; this.rawStatsRandomizer = rawStatsRandomizer; this.booleanPercentileSelector = booleanPercentileSelector; this.collectionsSelector = collectionsSelector; this.alignmentGenerator = alignmentGenerator; this.generator = generator; this.anyNPCClassNameRandomizer = anyNPCClassNameRandomizer; }
public FullNameGenerator(IFirstNameGenerator firstNameGenerator, ILastNameGenerator lastNameGenerator, ICharacterGenerator characterGenerator) { _firstNameGenerator = firstNameGenerator; _lastNameGenerator = lastNameGenerator; _characterGenerator = characterGenerator; }
static bool HandleCommandLineArgs(IEnumerable<string> args) { string fitnessType = "", crossoverType = ""; bool status = true; options = new OptionSet { {"m|mutation=", "The mutation rate (0-1)", (double v) => mutationRate = v}, {"s|crossover=", "The crossover rate (0-1)", (double v) => crossoverRate = v}, {"e|elitism=", "The elitism rate (0-1)", (double v) => elitismRate = v}, {"c|crcount=", "The number of chromosomes per population (>1)", (int v) => chromosomeCount = v}, {"fitness=", "The fitness calculator [sum | levenshtein | hamming]", v => fitnessType = v}, {"ctype=", "The crossover type [one | two ]", v => crossoverType = v}, {"t|truncate=", "The rate of the chromosomes to keep from a population before advancing (0 < t <= 1)", (double v) => truncationRate = v}, {"?|h|help", "Show help", v => { status = false; }}, {"<>", v => target = v} }; try { options.Parse(args); } catch (OptionException ex) { status = false; } fitness = (FitnessCalculator)Activator.CreateInstance(GetOperationType(fitnessTypes, fitnessType), new object[] { target }); crossover = (ICrossover)Activator.CreateInstance(GetOperationType(crossoverTypes, crossoverType), new object[] { fitness }); characterGenerator = new ASCIICharacterGenerator(); mutation = new SinglePointMutation(characterGenerator, fitness); selection = new RouletteWheelSelection(); if (String.IsNullOrEmpty(target) || mutationRate > 1 || crossoverRate > 1 || elitismRate > 1 || chromosomeCount <= 1 || truncationRate <= 0 || truncationRate > 1) { status = false; } return status; }
public TokenReplacement(INumberGenerator numberGenerator, ICharacterGenerator characterGenerator) { this.numberGenerator = numberGenerator; this.characterGenerator = characterGenerator; }
public LoginNameGenerator(ICharacterGenerator characterGenerator, INumberGenerator numberGenerator, ILastNameGenerator lastNameGenerator) { this.characterGenerator = characterGenerator; this.numberGenerator = numberGenerator; this.lastNameGenerator = lastNameGenerator; }
public void Setup() { SetUpMockRandomizers(); SetUpGenerators(); mockAdjustmentsSelector = new Mock<IAdjustmentsSelector>(); levelAdjustments = new Dictionary<string, int>(); mockRandomizerVerifier = new Mock<IRandomizerVerifier>(); mockPercentileSelector = new Mock<IPercentileSelector>(); mockCollectionsSelector = new Mock<ICollectionsSelector>(); levelAdjustments[BaseRace] = 0; levelAdjustments[BaseRaceMinusOne] = -1; levelAdjustments[RaceConstants.Metaraces.None] = 0; levelAdjustments[Metarace] = -1; mockAdjustmentsSelector.Setup(p => p.SelectFrom(TableNameConstants.Set.Adjustments.LevelAdjustments)).Returns(levelAdjustments); mockRandomizerVerifier.Setup(v => v.VerifyCompatibility(mockAlignmentRandomizer.Object, mockClassNameRandomizer.Object, mockLevelRandomizer.Object, mockBaseRaceRandomizer.Object, mockMetaraceRandomizer.Object)).Returns(true); mockRandomizerVerifier.Setup(v => v.VerifyCompatibility(mockAlignmentRandomizer.Object, mockClassNameRandomizer.Object, mockSetLevelRandomizer.Object, mockBaseRaceRandomizer.Object, mockMetaraceRandomizer.Object)).Returns(true); mockRandomizerVerifier.Setup(v => v.VerifyAlignmentCompatibility(It.IsAny<Alignment>(), mockClassNameRandomizer.Object, mockLevelRandomizer.Object, mockBaseRaceRandomizer.Object, mockMetaraceRandomizer.Object)).Returns(true); mockRandomizerVerifier.Setup(v => v.VerifyAlignmentCompatibility(It.IsAny<Alignment>(), mockClassNameRandomizer.Object, mockSetLevelRandomizer.Object, mockBaseRaceRandomizer.Object, mockMetaraceRandomizer.Object)).Returns(true); mockRandomizerVerifier.Setup(v => v.VerifyCharacterClassCompatibility(It.IsAny<Alignment>(), It.IsAny<CharacterClass>(), mockLevelRandomizer.Object, mockBaseRaceRandomizer.Object, mockMetaraceRandomizer.Object)).Returns(true); mockRandomizerVerifier.Setup(v => v.VerifyCharacterClassCompatibility(It.IsAny<Alignment>(), It.IsAny<CharacterClass>(), mockSetLevelRandomizer.Object, mockBaseRaceRandomizer.Object, mockMetaraceRandomizer.Object)).Returns(true); mockRandomizerVerifier.Setup(v => v.VerifyRaceCompatibility(It.IsAny<Race>(), It.IsAny<CharacterClass>(), mockLevelRandomizer.Object)).Returns(true); mockRandomizerVerifier.Setup(v => v.VerifyRaceCompatibility(It.IsAny<Race>(), It.IsAny<CharacterClass>(), mockSetLevelRandomizer.Object)).Returns(true); characterGenerator = new CharacterGenerator(mockAlignmentGenerator.Object, mockCharacterClassGenerator.Object, mockRaceGenerator.Object, mockAdjustmentsSelector.Object, mockRandomizerVerifier.Object, mockPercentileSelector.Object, mockAbilitiesGenerator.Object, mockCombatGenerator.Object, mockTreasureGenerator.Object, mockMagicGenerator.Object, generator, mockCollectionsSelector.Object); }
public FullNameGenerator(IFirstNameGenerator firstNameGenerator, ILastNameGenerator lastNameGenerator, ICharacterGenerator characterGenerator) { _firstNameGenerator = firstNameGenerator; _lastNameGenerator = lastNameGenerator; _characterGenerator = characterGenerator; }
public LoginNameGenerator(ICharacterGenerator characterGenerator, INumberGenerator numberGenerator, ILastNameGenerator lastNameGenerator) { this.characterGenerator = characterGenerator; this.numberGenerator = numberGenerator; this.lastNameGenerator = lastNameGenerator; }
public TokenReplacement(INumberGenerator numberGenerator, ICharacterGenerator characterGenerator) { this.numberGenerator = numberGenerator; this.characterGenerator = characterGenerator; }
public SinglePointMutation(ICharacterGenerator characterGenerator, FitnessCalculator fitnessCalculator) { this.fitnessCalculator = fitnessCalculator; random = new Random(); generator = characterGenerator; }