proofPiecesUtil.h
Go to the documentation of this file.
00001 /* proofPiecesUtil.h
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   } // namespace checkmate
00042 } // osl
00043 
00044 #endif /* OSL_PROOFPIECESUTIL_H */
00045 // ;;; Local Variables:
00046 // ;;; mode:c++
00047 // ;;; c-basic-offset:2
00048 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines