示例#1
0
        // compare two histories. Second can be shifted forward
        public bool CompareTo(AgentsHistory h, int numberOfMoves)
        {
            if (this.Count != h.Count)
            {
                throw new ArgumentException();
            }

            Enumerator h1 = this.GetEnumerator();
            Enumerator h2 = h.GetEnumerator();

            h1.MoveNext();
            h2.MoveNext();

            SizeF diff = SizeF.Subtract(new SizeF(h2.Current), new SizeF(h1.Current));

            for (int i = 0; i < numberOfMoves; i++)
            {
                while (true)
                {
                    PointF norm = h2.Current - diff;
                    if (h1.Current == norm)
                    {
                        break;
                    }
                    bool moves = h2.MoveNext();
                    if (!moves)
                    {
                        return(false);
                    }
                }
                h1.MoveNext();
                h2.MoveNext();
            }
            return(true);
        }
示例#2
0
        public override void PresentNewTrainingUnit()
        {
            CreateAgent();
            CreateTeacher();

            m_stepsSincePresented = 0;
            m_agentsHistory       = new AgentsHistory();
            m_agentsHistory.Add(m_agent.Position.X, m_agent.Position.Y);
            m_teachersHistory = new AgentsHistory();
            m_teachersHistory.Add(m_teacher.Position.X, m_teacher.Position.Y);
        }