Example #1
0
 public static Leaf Sequencer(FunctionalList <Leaf> leafList)
 {
     return(() =>
     {
         if (leafList.IsEmpty)
         {
             return State.SUCCESS;
         }
         else
         {
             State headState = leafList.Head();
             if (headState == State.SUCCESS)
             {
                 return Sequencer(leafList.Tail)();
             }
             else
             {
                 return headState;
             }
         }
     });
 }
Example #2
0
 public static Leaf Selector(FunctionalList <Leaf> leafList)
 {
     return(() =>
     {
         if (leafList.IsEmpty)
         {
             return State.FAILURE;
         }
         else
         {
             State headState = leafList.Head();
             if (headState == State.FAILURE)
             {
                 return Selector(leafList.Tail)();
             }
             else
             {
                 return headState;
             }
         }
     });
 }