Exemplo n.º 1
0
 private static int partition(ExtMove[] moves, int first, int last)
 {
     // move elements satisfying _Pred to beginning of sequence
     for (; ; ++first)
     {   // find any out-of-order pair
         for (; first != last && (moves[first].value > 0); ++first)
         {
             ;   // skip in-place elements at beginning
         }
         if (first == last)
         {
             break;      // done
         }
         for (; first != --last && (moves[last].value <= 0);)
         {
             ;   // skip in-place elements at end
         }
         if (first == last)
         {
             break;      // done
         }
         ExtMove temp = moves[last]; moves[last] = moves[first]; moves[first] = temp;
     }
     return(first);
 }
Exemplo n.º 2
0
        public static int pick_best(ExtMove[] moves, int begin, int end)
        {
            if (begin != end)
            {
                int cur = begin;
                int max = begin;
                while (++begin != end)
                {
                    if (moves[max].value < moves[begin].value)
                    {
                        max = begin;
                    }
                }
                ExtMove temp = moves[cur]; moves[cur] = moves[max]; moves[max] = temp;
                return(cur);
            }

            return(begin);
        }
Exemplo n.º 3
0
 public bool has_positive_score(ref ExtMove ms)
 {
     return(ms.value > 0);
 }
Exemplo n.º 4
0
 public static bool minThan(ref ExtMove f, ref ExtMove s)
 {
     return(f.value < s.value);
 }