Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
osl
checkmate
disproofPieces.h
Go to the documentation of this file.
1
/* disproofPieces.h
2
*/
3
#ifndef _DISPROOFPIECES_H
4
#define _DISPROOFPIECES_H
5
6
#include "
osl/checkmate/proofPiecesUtil.h
"
7
namespace
osl
8
{
9
namespace
checkmate
10
{
11
class
CheckMoveList;
12
struct
DisproofPieces
13
{
14
static
const
PieceStand
leaf
(
const
SimpleState& state,
Player
defender,
15
const
PieceStand
max
)
16
{
17
assert(state.turn() != defender);
18
PieceStand
result
;
19
ProofPiecesUtil::addMonopolizedPieces
(state, defender, max, result);
20
return
result
;
21
}
22
static
const
PieceStand
23
defense
(
const
PieceStand
prev,
Move
move,
const
PieceStand
max
)
24
{
25
assert(move.
isValid
());
26
PieceStand
result
= prev;
27
if
(move.
isDrop
())
28
{
29
const
Ptype
ptype = move.
ptype
();
30
if
(result.get(ptype) < max.
get
(ptype))
31
result.add(ptype);
32
}
33
else
34
{
35
const
Ptype
captured
= move.
capturePtype
();
36
if
(
isPiece
(captured))
37
{
38
const
Ptype
ptype =
unpromote
(captured);
39
result.trySub(ptype);
40
}
41
}
42
return
result
;
43
}
44
static
const
PieceStand
45
attack
(
const
CheckMoveList&
moves
,
const
SimpleState& state,
46
PieceStand
max
);
47
};
48
49
}
// namespace checkmate
50
}
// osl
51
52
#endif
/* _DISPROOFPIECES_H */
53
// ;;; Local Variables:
54
// ;;; mode:c++
55
// ;;; c-basic-offset:2
56
// ;;; End:
Generated on Sun Jul 21 2013 13:37:24 by
1.8.4