proofPiecesUtil.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
proofPiecesUtil.h
Go to the documentation of this file.
1 /* proofPiecesUtil.h
2 */
3 #ifndef OSL_PROOFPIECESUTIL_H
4 #define OSL_PROOFPIECESUTIL_H
5
6 #include "osl/pieceStand.h"
7 #include "osl/state/simpleState.h"
8 #include <boost/foreach.hpp>
9
10 namespace osl
11 {
12 namespace checkmate
13 {
14 class CheckMoveList;
18 struct ProofPiecesUtil
19 {
24 static
25 void addMonopolizedPieces(const SimpleState& state, Player player,
26 const PieceStand max, PieceStand& out)
27 {
28 const Player opponent = alt(player);
29 BOOST_FOREACH(Ptype ptype, PieceStand::order)
30 {
31 if (! state.hasPieceOnStand(opponent, ptype))
32 {
33 const int diff = max.get(ptype) - out.get(ptype);
34 assert(diff >= 0);
35 if (diff)
36 out.add(ptype, diff);
37 }
38 }
39 }
40 };
41 } // namespace checkmate
42 } // osl
43
44 #endif /* OSL_PROOFPIECESUTIL_H */
45 // ;;; Local Variables:
46 // ;;; mode:c++
47 // ;;; c-basic-offset:2
48 // ;;; End: