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); }
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); }
public bool has_positive_score(ref ExtMove ms) { return(ms.value > 0); }
public static bool minThan(ref ExtMove f, ref ExtMove s) { return(f.value < s.value); }