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