All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sortCaptureMoves.cc
Go to the documentation of this file.
1 /* sortCaptureMoves.cc
2  */
7 #include <algorithm>
8 
10 {
11  std::sort(moves.begin(), moves.end(), move_order::CheapPtype());
12 }
13 
14 namespace osl
15 {
16  namespace search
17  {
19  {
21  explicit OrderSpecifiedPiece(Square f) : from(f)
22  {
23  }
24  bool operator()(Move l, Move r) const
25  {
26  const Square from_l = l.from();
27  if (from_l == from)
28  return true;
29  const Square from_r = r.from();
30  if (from_r == from)
31  return false;
32 
33  return move_order::CheapPtype()(l, r);
34  }
35  };
36  } // anonymous namespace
37 } // namespace osl
38 
40 sortBySpecifiedPiece(MoveVector& moves, Square from)
41 {
42  std::sort(moves.begin(), moves.end(), OrderSpecifiedPiece(from));
43 }
44 
46 sortByTakeBack(const NumEffectState& state, MoveVector& moves)
47 {
48  std::sort(moves.begin(), moves.end(),
50 }
51 
52 /* ------------------------------------------------------------------------- */
53 // ;;; Local Variables:
54 // ;;; mode:c++
55 // ;;; c-basic-offset:2
56 // ;;; End: