Exemplo n.º 1
0
        public virtual void UpdateOpinion(BlackWhiteSubject sub, BeliefUpdater updater)
        {
            thought.Belief = updater.updateBelief(sub, thought.Belief);


            //意見を変える際に、カウント
            if (sub == BlackWhiteSubject.White)
            {
                counter.CountUp();
            }
            else //if(sub == BlackWhiteSubject.Black)
            {
                counter.CountDown();
            }
        }
Exemplo n.º 2
0
        public void UpdateCounter_Counterの正常系テスト()
        {
            UpdateCounter counter = new UpdateCounter();

            counter.CountUp();
            counter.CountUp();
            counter.CountUp();

            Assert.AreEqual(counter.UpdateNum, 3);
            Assert.AreEqual(counter.UpdateRight, 3);
            Assert.AreEqual(counter.UpdateLeft, 0);

            counter.CountDown();
            counter.CountDown();
            counter.CountDown();

            Assert.AreEqual(counter.UpdateNum, 0);
            Assert.AreEqual(counter.UpdateRight, 3);
            Assert.AreEqual(counter.UpdateLeft, 0);

            counter.CountDown();
            counter.CountDown();
            counter.CountDown();

            Assert.AreEqual(counter.UpdateNum, -3);
            Assert.AreEqual(counter.UpdateRight, 3);
            Assert.AreEqual(counter.UpdateLeft, 3);

            counter.CountUp();
            counter.CountUp();
            counter.CountUp();

            Assert.AreEqual(counter.UpdateNum, 0);
            Assert.AreEqual(counter.UpdateRight, 3);
            Assert.AreEqual(counter.UpdateLeft, 3);
            //Assert.AreEqual(agent.Belief, agent.PriorBelief);

            //Assert.IsTrue(Math.Abs(agent.Belief - agent.PriorBelief) < 0.00001);
        }