コード例 #1
0
        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();
        }
コード例 #2
0
        public void AnalyzeAndLearn_ShortTermAngerLowered_LongTermAngerLowered()
        {
            //Arrange
            MainEmotionLearningStrategy strategy = new MainEmotionLearningStrategy();

            var Rick = new Person("Rick", Gender.Male, Sex.Male, Orientation.Pansexual, Guid.NewGuid());

            var character = new global::RNPC.Core.Character(Rick, Archetype.TheCreator)
            {
                FileController      = new DecisionTreeFileController(),
                DecisionTreeBuilder = new DecisionTreeBuilder()
            };
            int initialAnger = character.MyTraits.LongTermEmotions.Anger;

            character.MyTraits.ShortTermEmotions.Anger = 0;
            //ACT
            strategy.AnalyzeAndLearn(character);
            //Assert
            Assert.IsTrue(character.MyTraits.LongTermEmotions.Anger < initialAnger);
        }
コード例 #3
0
        public void AnalyzeAndLearn_ShortTermDisappointmentRaised_LongTermDisappointmentRaised()
        {
            //Arrange
            MainEmotionLearningStrategy strategy = new MainEmotionLearningStrategy();

            var Rick = new Person("Rick", Gender.Male, Sex.Male, Orientation.Pansexual, Guid.NewGuid());

            var character = new global::RNPC.Core.Character(Rick, Archetype.TheCreator)
            {
                FileController      = new DecisionTreeFileController(),
                DecisionTreeBuilder = new DecisionTreeBuilder()
            };
            int initialDisappointment = character.MyTraits.LongTermEmotions.Disappointment;

            character.MyTraits.ShortTermEmotions.Disappointment = 20;
            //ACT
            strategy.AnalyzeAndLearn(character);
            //Assert
            Assert.IsTrue(character.MyTraits.LongTermEmotions.Disappointment > initialDisappointment);
            Console.WriteLine(@"New value:" + character.MyTraits.LongTermEmotions.Disappointment);
        }