public void Learn(string program)
 {
     if (clonned)
     {
         LearnedProgramms = LearnedProgramms.Copy();
         clonned          = false;
     }
     RollbackedProgramms = new NodeStack <string>();
     LearnedProgramms.Push(program);
 }
 public void Relearn()
 {
     if (clonned)
     {
         LearnedProgramms    = LearnedProgramms.Copy();
         RollbackedProgramms = RollbackedProgramms.Copy();
         clonned             = false;
     }
     LearnedProgramms.Push(RollbackedProgramms.Pop());
 }
        public NodeStack <T> Copy()
        {
            NodeStack <T> nodeStack = new NodeStack <T>();
            List <T>      list      = new List <T>();
            Node <T>      current   = head;

            while (current != null)
            {
                list.Add(current.Data);
                current = current.Next;
            }
            list.Reverse();
            foreach (var item in list)
            {
                nodeStack.Push(item);
            }
            return(nodeStack);
        }
 public Clone()
 {
     LearnedProgramms = new NodeStack <string>();
 }