コード例 #1
0
        public void AnalyzeAndLearn_TestDecisionTreeEvolutions_DecisionTreeChanged()
        {
            //ARRANGE
            //"C:\\Sysdev\\RNPC\\RNPC\\DTO\\Learning\\Resources\\DecisionTreeSubstitutions.xml";
            var controller = new SubstitutionController(new SubstitutionDocumentConverter(), new DecisionTreeFileController(), new SubstitutionMapper());
            MainDecisionTreeLearningStrategy strategy = new MainDecisionTreeLearningStrategy(controller, new DecisionTreeBuilder());

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

            var character = new global::RNPC.Core.Character(Morty, Archetype.TheInnocent)
            {
                FileController      = new DecisionTreeFileController(),
                DecisionTreeBuilder = new DecisionTreeBuilder()
            };

            //Initial Action
            //Friendly Greeting
            Action greeting = new Action
            {
                EventType  = EventType.Interaction,
                ActionType = ActionType.Verbal,
                Intent     = Intent.Friendly,
                Message    = "Hi!",
                Target     = character.MyName,
                EventName  = "Greeting",
                Source     = "The Friend"
            };

            var reaction = new Reaction
            {
                Tone          = Tone.Neutral,
                Target        = greeting.Source,
                Intent        = Intent.Neutral,
                ActionType    = ActionType.Verbal,
                InitialEvent  = greeting,
                EventType     = EventType.Interaction,
                ReactionScore = 0,
                EventName     = "Greeting",
                Message       = "Hello.", //TODO: Randomize
                Source        = greeting.Target
            };

            character.MyMemory.AddActionToLongTermMemory(reaction);
            character.MyMemory.AddActionToLongTermMemory(reaction);
            character.MyMemory.AddActionToLongTermMemory(reaction);

            //ACT
            strategy.AnalyzeAndLearn(character);
            //ASSERT
        }
コード例 #2
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();
        }
コード例 #3
0
        public void AnalyzeAndLearn_NoLearningDone_NoDecisionTreeChanged()
        {
            //ARRANGE
            //"C:\\Sysdev\\RNPC\\RNPC\\DTO\\Learning\\Resources\\DecisionTreeSubstitutions.xml";
            var controller = new SubstitutionController(new SubstitutionDocumentConverter(), new DecisionTreeFileController(), new SubstitutionMapper());
            MainDecisionTreeLearningStrategy strategy = new MainDecisionTreeLearningStrategy(controller, new DecisionTreeBuilder());

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

            var character = new global::RNPC.Core.Character(Morty, Archetype.TheInnocent)
            {
                FileController      = new DecisionTreeFileController(),
                DecisionTreeBuilder = new DecisionTreeBuilder()
            };

            //ACT
            strategy.AnalyzeAndLearn(character);
            //ASSERT
            Assert.IsFalse(strategy.DecisionTreeEvolved);
        }