Exemple #1
0
        /// <summary>
        /// Updates the conflicts member according to given CATs. Both tables may be null.
        /// </summary>
        /// <param name="ID_CAT"></param>
        /// <param name="CBS_CAT"></param>
        public void SetConflicts(Dictionary <TimedMove, List <int> > ID_CAT, Dictionary <TimedMove, List <int> > CBS_CAT)
        {
            TimedMove queryMove = new TimedMove();

            if (this.prevStep == null)
            {
                return;
            }
            for (int i = 0; i < allSteps.Length; i++)
            {
                // TODO: Kill this code dup. The ConflictAvoidanceTable class takes care of it.
                queryMove.setup(allSteps[i].move.x, allSteps[i].move.y, Move.Direction.NO_DIRECTION, allSteps[i].move.time);
                if (ID_CAT != null && ID_CAT.ContainsKey(queryMove))
                {
                    conflicts++;
                }
                if (CBS_CAT != null && CBS_CAT.ContainsKey(queryMove))
                {
                    conflicts++;
                }
                queryMove.direction = allSteps[i].move.direction;
                queryMove.setOppositeMove();
                if (ID_CAT != null && ID_CAT.ContainsKey(queryMove))
                {
                    conflicts++;
                }
                if (CBS_CAT != null && CBS_CAT.ContainsKey(queryMove))
                {
                    conflicts++;
                }
            }
        }
Exemple #2
0
        public void setConflicts(HashSet <TimedMove> ID_CAT, HashSet_U <TimedMove> CBS_CAT)
        {
            TimedMove m2 = new TimedMove();

            if (this.prevStep == null)
            {
                return;
            }
            for (int i = 0; i < allSteps.Length; i++)
            {
                m2.setup(allSteps[i].getX(), allSteps[i].getY(), Move.Direction.NO_DIRECTION, getDepth());
                if (ID_CAT != null && ID_CAT.Contains(m2))
                {
                    conflicts++;
                }
                if (CBS_CAT != null && CBS_CAT.Contains(m2))
                {
                    conflicts++;
                }
                m2.direction = Move.getDirection(allSteps[i].getX(), allSteps[i].getY(), prevStep.allSteps[i].getX(), prevStep.allSteps[i].getY());
                m2.setOppositeMove();
                if (ID_CAT != null && ID_CAT.Contains(m2))
                {
                    conflicts++;
                }
                if (CBS_CAT != null && CBS_CAT.Contains(m2))
                {
                    conflicts++;
                }
            }
        }