Exemplo n.º 1
0
        private void LoadAllUncertainFacts()
        {
            #region Uncertain Facts/States about the User

            //3 button answer
            UncertainFacts.AddUncertainFact(new UncertainFact("UserGoodMood", false, "Are you in a good mood?",
                                                              new VarRef <FiniteDist <bool> >(() => ProbVariables.User.InAGoodMood, val => { ProbVariables.User.InAGoodMood = val; }),
                                                              new string[3] {
                "Not so well", "Fine", "Great"
            }, new double[3] {
                0.3, 0.7, 0.85
            },
                                                              UIAnswer.MultiAnswer
                                                              ));

            //3 button answer
            UncertainFacts.AddUncertainFact(new UncertainFact("UserIsTired", false, "Do you feel tired?",
                                                              new VarRef <FiniteDist <bool> >(() => ProbVariables.User.Tired, val => { ProbVariables.User.Tired = val; }),
                                                              new string[3] {
                phrases.No(), "A little bit", phrases.Yes()
            }, new double[3] {
                0.3, 0.6, 0.9
            },
                                                              UIAnswer.MultiAnswer
                                                              ));
            #endregion

            #region Uncertain Facts/Activities about the Bot

            //3 button answer
            UncertainFacts.AddUncertainFact(new UncertainFact("BotAsksIfJokeRateIsOK", true, "Do you like my jokes? Should I tell jokes more often?",
                                                              new VarRef <FiniteDist <bool> >(() => ProbVariables.User.JokeRate, val => { ProbVariables.User.JokeRate = val; }),
                                                              new string[3] {
                "Slow down", "Same rate", "More frequently"
            },
                                                              UIAnswer.MultiAnswer, 0.15
                                                              ));
            //3 button answer
            UncertainFacts.AddUncertainFact(new UncertainFact("BotChangeOutfit", true, "Do you want me to change my outfit more often?",
                                                              new VarRef <FiniteDist <bool> >(() => ProbVariables.Bot.ChangeVisualAppearance, val => { ProbVariables.Bot.ChangeVisualAppearance = val; }),
                                                              new string[3] {
                "Less frequently", "Same rate", "Change more"
            },
                                                              UIAnswer.MultiAnswer, 0.03
                                                              ));
            #endregion

            #region debug
            foreach (var item in UncertainFacts.GetList())
            {
                if (item.ProbabilitiesForEachPossibleAnswer.Sum() == 0)
                {
                    SharedHelper.LogError("Probabilities are all 0!!! for " + item.Name);
                }
            }
            #endregion
        }
Exemplo n.º 2
0
        public Item[] GetAll()
        {
            List <Item> items = new List <Item>();

            items.AddRange(UncertainFacts.GetList());
            items.AddRange(JokesProvider.GetAll());

            foreach (var manager in providers)
            {
                int oldCount = items.Count;
                items.AddRange(manager.GetAll());
                if (items.Count == oldCount)
                {
                    SharedHelper.LogError("No items were loaded for: " + manager.ToString());
                }
            }

            return(items.ToArray());
        }
Exemplo n.º 3
0
        public void LoadAll(ItemManager[] providers)
        {
            this.providers = providers;

            LoadAllPureFacts();
            LoadAllUncertainFacts();

            LoadAllJokes(); //PureFacts must be already loaded because some PureFacts are used as jokes
            LoadAllSongs();
            LoadSports();
            LoadMovies();

            int count = UncertainFacts.GetList().Count
                        + JokesProvider.GetAll().Count();

            foreach (var manager in providers)
            {
                count += manager.Count();
            }

            SharedHelper.Log("All items loaded: " + count + " " + BotConfigShared.Language);
        }