Beispiel #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;
             }
         }
     });
 }
Beispiel #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;
             }
         }
     });
 }
Beispiel #3
0
 public FunctionalList(T head, FunctionalList <T> tail)
 {
     IsEmpty = false;
     Head    = head;
     Tail    = tail;
 }
Beispiel #4
0
 public static Leaf RandomSelector(FunctionalList <Leaf> leafList)
 {
     // placeholder code
     return(() => { return State.FAILURE; });
 }