Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
lib
search
sortCaptureMoves.cc
Go to the documentation of this file.
1
/* sortCaptureMoves.cc
2
*/
3
#include "
osl/search/sortCaptureMoves.h
"
4
#include "
osl/move_order/captureEstimation.h
"
5
#include "
osl/move_order/cheapPtype.h
"
6
#include "
osl/container/moveVector.h
"
7
#include <algorithm>
8
9
void
osl::search::SortCaptureMoves::sortByMovingPiece
(MoveVector&
moves
)
10
{
11
std::sort(moves.begin(), moves.end(),
move_order::CheapPtype
());
12
}
13
14
namespace
osl
15
{
16
namespace
search
17
{
18
struct
OrderSpecifiedPiece
19
{
20
Square
from
;
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
39
void
osl::search::SortCaptureMoves::
40
sortBySpecifiedPiece
(MoveVector&
moves
,
Square
from)
41
{
42
std::sort(moves.begin(), moves.end(),
OrderSpecifiedPiece
(from));
43
}
44
45
void
osl::search::SortCaptureMoves::
46
sortByTakeBack
(
const
NumEffectState& state, MoveVector&
moves
)
47
{
48
std::sort(moves.begin(), moves.end(),
49
move_order::CaptureEstimation
(state));
50
}
51
52
/* ------------------------------------------------------------------------- */
53
// ;;; Local Variables:
54
// ;;; mode:c++
55
// ;;; c-basic-offset:2
56
// ;;; End:
Generated on Sun Jul 21 2013 13:37:27 by
1.8.4