Go to the documentation of this file.00001
00002
00003 #ifndef OSL_PROOFPIECESUTIL_H
00004 #define OSL_PROOFPIECESUTIL_H
00005
00006 #include "osl/pieceStand.h"
00007 #include "osl/state/simpleState.h"
00008 #include <boost/foreach.hpp>
00009
00010 namespace osl
00011 {
00012 namespace checkmate
00013 {
00014 class CheckMoveList;
00018 struct ProofPiecesUtil
00019 {
00024 static
00025 void addMonopolizedPieces(const SimpleState& state, Player player,
00026 const PieceStand max, PieceStand& out)
00027 {
00028 const Player opponent = alt(player);
00029 BOOST_FOREACH(Ptype ptype, PieceStand::order)
00030 {
00031 if (! state.hasPieceOnStand(opponent, ptype))
00032 {
00033 const int diff = max.get(ptype) - out.get(ptype);
00034 assert(diff >= 0);
00035 if (diff)
00036 out.add(ptype, diff);
00037 }
00038 }
00039 }
00040 };
00041 }
00042 }
00043
00044 #endif
00045
00046
00047
00048