Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
osl
search
shouldPromoteCut.h
Go to the documentation of this file.
1
/* shouldPromoteCut.h
2
*/
3
#ifndef _SEARCH_SHOULDPROMOTECUT_H
4
#define _SEARCH_SHOULDPROMOTECUT_H
5
6
#include "
osl/ptypeTable.h
"
7
#include "
osl/player.h
"
8
#include "
osl/move.h
"
9
namespace
osl
10
{
11
namespace
search
12
{
19
struct
ShouldPromoteCut
20
{
21
template
<Player P>
22
static
bool
canIgnore
(
Ptype
ptype,
Square
from,
Square
to)
23
{
24
assert(! from.
isPieceStand
());
25
return
(ptype==
LANCE
&& (P==
BLACK
? to.
y
()==2 : to.
y
()==8)) ||
26
(
isBasic
(ptype) &&
Ptype_Table
.
isBetterToPromote
(ptype)
27
&& (to.
canPromote
<P>() || from.
canPromote
<P>()));
28
}
32
template
<Player Moving>
33
static
bool
canIgnoreMove
(
Move
move)
34
{
35
assert(! move.
isDrop
());
36
return
canIgnore<Moving>(move.
ptype
(), move.
from
(), move.
to
());
37
}
41
template
<Player Moving>
42
static
bool
canIgnoreAndNotDrop
(
Move
move)
43
{
44
return
(! move.
isDrop
()) && canIgnoreMove<Moving>(move);
45
}
46
static
bool
canIgnoreAndNotDrop
(
Move
move)
47
{
48
if
(move.
player
() ==
BLACK
)
49
return
canIgnoreAndNotDrop<BLACK>(move);
50
else
51
return
canIgnoreAndNotDrop<WHITE>(move);
52
}
53
};
54
55
56
}
// namespace search
57
}
// osl
58
59
#endif
/* _SHOULDPROMOTECUT_H */
60
// ;;; Local Variables:
61
// ;;; mode:c++
62
// ;;; c-basic-offset:2
63
// ;;; End:
Generated on Sun Jul 21 2013 13:37:27 by
1.8.4