Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
osl
move_classifier
moveAdaptor.h
Go to the documentation of this file.
1
/* moveAdaptor.h
2
*/
3
#ifndef OSL_MOVE_CLASSIFIER_MOVE_ADAPTOR_H
4
#define OSL_MOVE_CLASSIFIER_MOVE_ADAPTOR_H
5
6
#include "
osl/state/numEffectState.h
"
7
#include "
osl/move_classifier/classifierTraits.h
"
8
namespace
osl
9
{
10
namespace
move_classifier
11
{
12
template
<
class
Classifier>
13
struct
MoveAdaptor
14
{
15
static
bool
isMember
(
const
NumEffectState& state,
Move
m)
16
{
17
return
Classifier::isMember(state, m.
ptype
(), m.
from
(), m.
to
());
18
}
19
};
20
21
template
<
template
<Player>
class
Classifier>
22
struct
PlayerMoveAdaptor
23
{
24
template
<
class
State>
25
static
bool
isMember
(
const
State
& state,
Move
m)
26
{
27
assert(m.
player
() == state.turn());
28
if
(state.turn() ==
BLACK
)
29
return
Classifier<BLACK>::isMember
(state, m.
ptype
(), m.
from
(), m.
to
());
30
else
31
return
Classifier<WHITE>::isMember
(state, m.
ptype
(), m.
from
(), m.
to
());
32
}
33
};
34
36
template
<
template
<Player>
class
Classifier>
37
struct
ConditionAdaptor
38
{
39
template
<
class
State>
40
static
bool
isMember
(
const
State
& state,
Move
m)
41
{
42
if
(!
ClassifierTraits
<
Classifier<BLACK>
>::drop_suitable
43
&& m.
isDrop
())
44
return
ClassifierTraits
<
Classifier<BLACK>
>::result_if_drop;
45
return
PlayerMoveAdaptor<Classifier>::isMember
(state, m);
46
}
47
};
48
}
// namespace move_classifier
49
}
// namespace osl
50
51
#endif
/* OSL_MOVE_CLASSIFIER_MOVE_ADAPTOR_H */
52
// ;;; Local Variables:
53
// ;;; mode:c++
54
// ;;; c-basic-offset:2
55
// ;;; End:
Generated on Sun Jul 21 2013 13:37:25 by
1.8.4