コード例 #1
0
        public void TestFindMostInfluential()
        {
            double[] arr = { 700, 600, 500, 400, 300, 200, 100, 0 };
            SetNpcTone(arr);
            Dictionary <string, double> d    = ctrl.Npc.InitiatorsTone;
            Dictionary <string, double> temp = bd.FindMostInfluentialAttribute(d);

            Assert.IsTrue(temp.ContainsKey("romance"));
            Assert.IsTrue(temp.Count == 1);
            Assert.IsTrue(!d.ContainsKey("romance"));
            Assert.IsTrue(d.Count == 7);
            temp = bd.FindMostInfluentialAttribute(d);
            Assert.IsTrue(temp.ContainsKey("friend"));
            Assert.IsTrue(temp.ContainsKey("professional"));
            Assert.IsTrue(temp.Count == 2);
            Assert.IsTrue(!d.ContainsKey("friend"));
            Assert.IsTrue(!d.ContainsKey("professional"));
            Assert.IsTrue(d.Count == 5);
            temp = bd.FindMostInfluentialAttribute(d);
            Assert.IsTrue(temp.ContainsKey("respect"));
            Assert.IsTrue(temp.ContainsKey("affinity"));
            Assert.IsTrue(temp.ContainsKey("disgust"));
            Assert.IsTrue(temp.Count == 3);
            Assert.IsTrue(!d.ContainsKey("respect"));
            Assert.IsTrue(!d.ContainsKey("affinity"));
            Assert.IsTrue(!d.ContainsKey("disgust"));
            Assert.IsTrue(d.Count == 2);
            temp = bd.FindMostInfluentialAttribute(d);
            Assert.IsTrue(temp == d);
            Assert.IsTrue(bd.IsNeutral);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ResoTheRed/NLG
        public static void TestA(int n)
        {
            for (int i = 0; i < n; i++)
            {
                Start();
                double[] arr = { 700, 600, 500, 400, 300, 200, 100, 0 };
                SetNpcTone(arr);
                Dictionary <string, double> d = ctrl.Npc.InitiatorsTone;
                d = bd.CancelAttributeTones();
                Console.WriteLine("d[romance] == 600: " + d["romance"]);
                Console.WriteLine("d[friend] == 750.0" + d["friend"]);
                Console.WriteLine("d[professional] == 600.0: " + (d["professional"]));
                Console.WriteLine("d[respect] == 400.0: " + (d["respect"]));
                Console.WriteLine("d[affinity] == 400.0: " + d["affinity"]);
                Console.WriteLine("d[disgust] < 0: " + d["disgust"]);
                Console.WriteLine("d[hate] < 0" + d["hate"]);
                Console.WriteLine("d[rivalry] < 0" + d["rivalry"]);

                //high
                Console.WriteLine("\n--------Running High Stats-------------------------");
                var copy = bd.FindMostInfluentialAttribute(d);
                Console.WriteLine("copy.ContainsKey(friend) " + copy.ContainsKey("friend"));
                Console.WriteLine("copy.Count == 1: " + (copy.Count == 1));
                foreach (KeyValuePair <string, double> item in copy)
                {
                    Console.WriteLine("copy[" + item.Key + "] : " + item.Value);
                }

                double total = bd.ProbabilityOffset(copy);
                Console.WriteLine("total 120: " + total + "\n Should only contain friend");//was 870 but reduced by min with is 750 and also max
                foreach (KeyValuePair <string, double> item in copy)
                {
                    Console.WriteLine("copy[" + item.Key + "] : " + item.Value + " == total: " + total);
                }
                List <string> list = bd.PickAtttibutes(copy, total);
                Console.WriteLine("List should have one element friend");
                int counter = 0;
                foreach (string s in list)
                {
                    Console.WriteLine("list[" + counter + "] : " + s);
                    counter++;
                }
                //mid
                Console.WriteLine("\n--------Running Mid Stats--------------------------");
                copy = bd.FindMostInfluentialAttribute(d);
                Console.WriteLine("Should contain only romance and professional");
                foreach (KeyValuePair <string, double> item in copy)
                {
                    Console.WriteLine("copy[" + item.Key + "] : " + item.Value);
                }
                total = bd.ProbabilityOffset(copy);
                Console.WriteLine("total 280: " + total + "\n Should only contain romance and professional");//was 870 but reduced by min with is 750 and also max
                foreach (KeyValuePair <string, double> item in copy)
                {
                    Console.WriteLine("copy[" + item.Key + "] : " + item.Value + " == total: " + total);
                }
                list = bd.PickAtttibutes(copy, total);
                Console.WriteLine("List should have romance and professional");
                counter = 0;
                foreach (string s in list)
                {
                    Console.WriteLine("list[" + counter + "] : " + s);
                    counter++;
                }
                //low
                Console.WriteLine("\n--------Running Low Stats--------------------------");
                copy = bd.FindMostInfluentialAttribute(d);
                Console.WriteLine("Should contain only affinity and respect");
                foreach (KeyValuePair <string, double> item in copy)
                {
                    Console.WriteLine("copy[" + item.Key + "] : " + item.Value);
                }
                total = bd.ProbabilityOffset(copy);
                Console.WriteLine("total 240: " + total + "\n Should only contain affinity and respect");//was 870 but reduced by min with is 750 and also max
                foreach (KeyValuePair <string, double> item in copy)
                {
                    Console.WriteLine("copy[" + item.Key + "] : " + item.Value + " == total: " + total);
                }
                list = bd.PickAtttibutes(copy, total);
                Console.WriteLine("List should have afinity and respect");
                counter = 0;
                foreach (string s in list)
                {
                    Console.WriteLine("list[" + counter + "] : " + s);
                    counter++;
                }
                //none-->neutral
                Console.WriteLine("\n--------Running Neutral----------------------------");
                copy  = bd.FindMostInfluentialAttribute(d);
                total = bd.ProbabilityOffset(copy);
                Console.WriteLine("Total: " + total + " IsNeutral: " + bd.IsNeutral);
                list = bd.PickAtttibutes(copy, total);
                Console.WriteLine("List should have neutral");
                counter = 0;
                foreach (string s in list)
                {
                    Console.WriteLine("list[" + counter + "] : " + s);
                    counter++;
                }
            }
        }