internal MainLearningMethod(IXmlFileController fileController, ITreeBuilder builder) { ActionLearningStrategy = new MainActionLearningStrategy(); var controller = new SubstitutionController(new SubstitutionDocumentConverter(), fileController, new SubstitutionMapper()); DecisionTreeLearningStrategy = new MainDecisionTreeLearningStrategy(controller, builder); DesireLearningStrategy = new MainDesireLearningStrategy(); EmotionLearningStrategy = new MainEmotionLearningStrategy(); MemoryLearningStrategy = new MainMemoryLearningStrategy(); OpinionLearningStrategy = new MainOpinionLearningStrategy(); PersonalValueLearningStrategy = new MainPersonalValueLearningStrategy(new PersonalValueAssociations()); QualityLearningStrategy = new MainQualityLearningStrategy(); }
public void AnalyzeAndLearn_NRVAValuesTests_NewValueAdded2PercentOfTheTime() { //ARRANGE var learningStrategy = new MainPersonalValueLearningStrategy(new PersonalValueAssociations()); var Morty = new Person("Morty", Gender.Male, Sex.Male, Orientation.Straight, Guid.NewGuid()); int[] compiledResults = { 0, 0 }; //ACT for (int i = 0; i < 1000; i++) { var character = new global::RNPC.Core.Character(Morty, Archetype.TheInnocent) { FileController = new DecisionTreeFileController(), DecisionTreeBuilder = new DecisionTreeBuilder() }; List <NodeTestInfo> nodeTests = new List <NodeTestInfo> { new NodeTestInfo { CharacteristicName = "Determination", TestedCharacteristic = CharacteristicType.Values, Result = false, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Determination", TestedCharacteristic = CharacteristicType.Values, Result = false, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Determination", TestedCharacteristic = CharacteristicType.Values, Result = false, AttributeValue = 0, Modifier = 0 } }; character.MyMemory.AddNodeTestResults(nodeTests); bool result = RunAddingValueLearningTest(character, learningStrategy); if (result) { compiledResults[0]++; } else { compiledResults[1]++; } } //ASSERT //Stat is 2%. with random we allow +-2% Assert.IsTrue(compiledResults[0] < 40); Assert.IsTrue(compiledResults[0] > 0); }
public void AnalyzeAndLearn_EightAchievementTests_NewValueRemoved30PercentOfTheTime() { //ARRANGE var learningStrategy = new MainPersonalValueLearningStrategy(new PersonalValueAssociations()); var Rick = new Person("Rick", Gender.Male, Sex.Male, Orientation.Pansexual, Guid.NewGuid()); int[] compiledResults = { 0, 0 }; //ACT for (int i = 0; i < 1000; i++) { var character = new global::RNPC.Core.Character(Rick, Archetype.TheCreator) { FileController = new DecisionTreeFileController(), DecisionTreeBuilder = new DecisionTreeBuilder() }; //PersonalValues.Achievement List <NodeTestInfo> nodeTests = new List <NodeTestInfo> { new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 }, new NodeTestInfo { CharacteristicName = "Achievement", TestedCharacteristic = CharacteristicType.Values, Result = true, AttributeValue = 0, Modifier = 0 } }; character.MyMemory.AddNodeTestResults(nodeTests); bool result = RunRemovingValueLearningTest(character, learningStrategy); if (result) { compiledResults[0]++; } else { compiledResults[1]++; } //We add it back to the list character.MyTraits.PersonalValues.Add(PersonalValues.Achievement); } //ASSERT //Stat is 30%. with random we allow +-3.5% //if(compiledResults[0] > 330) // Console.WriteLine(compiledResults[0]); Assert.IsTrue(compiledResults[0] <= 335); //if (compiledResults[0] < 270) // Console.WriteLine(compiledResults[0]); Assert.IsTrue(compiledResults[0] >= 265); }