/// <summary>
 /// <see cref="IElement.RemoveItem" />
 /// </summary>
 public override void RemoveItem(object objectToRemove)
 {
     if (typeof(ICondition) == objectToRemove.GetType())
     {
         _ifCondition = null;
     }
     else
     {
         if (_ifInstruction != null && _ifInstruction.Equals(objectToRemove))
         {
             _ifInstruction = null;
         }
         else
         {
             _elseInstruction = null;
         }
     }
 }
        private void ExpensiveCheck(bool precise)
        {
            for (int a = 0; a < project.Rules.CoreSize; a++)
            {
                IInstruction iOne = engineOne[a];
                IInstruction iTwo = engineTwo[a];
                if (!iOne.Equals(iTwo))
                {
                    throw new EngineDifferException("Core", new Check(engineOne.Round, engineOne.Cycle, precise));
                }
            }
            IList <IPSpace> psapacesOne = engineOne.PSpaces;
            IList <IPSpace> psapacesTwo = engineTwo.PSpaces;

            for (int w = 0; w < project.Rules.WarriorsCount; w++)
            {
                if (!psapacesOne[w].Equals(psapacesTwo[w]))
                {
                    throw new EngineDifferException("PSpaces", new Check(engineOne.Round, engineOne.Cycle, precise));
                }

                if (engineOne.LastResults[w] != engineTwo.LastResults[w])
                {
                    throw new EngineDifferException("LastResult", new Check(engineOne.Round, engineOne.Cycle, precise));
                }
                if (engineOne.PSPaceIndexes[w] != engineTwo.PSPaceIndexes[w])
                {
                    throw new EngineDifferException("PSPaceIndexes",
                                                    new Check(engineOne.Round, engineOne.Cycle, precise));
                }
                if (engineOne.Warriors[w].Pin != engineTwo.Warriors[w].Pin)
                {
                    throw new EngineDifferException("Pin", new Check(engineOne.Round, engineOne.Cycle, precise));
                }
                IEnumerable <int> tasksOne = engineOne.Tasks[w];
                IEnumerable <int> tasksTwo = engineTwo.Tasks[w];

                IEnumerator <int> enumerator1 = tasksOne.GetEnumerator();
                IEnumerator <int> enumerator2 = tasksTwo.GetEnumerator();

                try
                {
                    while (enumerator1.MoveNext())
                    {
                        if (!enumerator2.MoveNext())
                        {
                            throw new EngineDifferException("Task Died",
                                                            new Check(engineOne.Round, engineOne.Cycle, precise));
                        }
                        if (enumerator1.Current != enumerator2.Current)
                        {
                            throw new EngineDifferException("Bad IP",
                                                            new Check(engineOne.Round, engineOne.Cycle, precise));
                        }
                    }
                    if (enumerator2.MoveNext())
                    {
                        throw new EngineDifferException("Task Died",
                                                        new Check(engineOne.Round, engineOne.Cycle, precise));
                    }
                }
                finally
                {
                    enumerator1.Dispose();
                    enumerator2.Dispose();
                }
            }
        }