proofPieces.h
Go to the documentation of this file.
00001 /* proofPieces.h
00002  */
00003 #ifndef _PROOFPIECES_H
00004 #define _PROOFPIECES_H
00005 
00006 #include "osl/checkmate/proofPiecesUtil.h"
00007 #include "osl/effect_util/unblockableCheck.h"
00008 namespace osl
00009 {
00010   namespace checkmate
00011   {
00012     class CheckMoveList;
00013     struct ProofPieces
00014     {
00015       static const PieceStand leaf(const NumEffectState& state, 
00016                                    Player attacker, const PieceStand max)
00017       {
00018         assert(state.turn() != attacker);
00019         PieceStand result;
00020         if (! effect_util::UnblockableCheck::isMember(alt(attacker), state))
00021           ProofPiecesUtil::addMonopolizedPieces(state, attacker, max, result);
00022         return result;
00023       }
00024       static const PieceStand
00025       attack(const PieceStand prev, Move move, const PieceStand max)
00026       {
00027         assert(move.isValid());
00028         PieceStand result = prev;
00029         if (move.isDrop())
00030         {
00031           const Ptype ptype = move.ptype();
00032           if (result.get(ptype) < max.get(ptype))
00033             result.add(ptype);
00034         }
00035         else 
00036         {
00037           const Ptype captured = move.capturePtype();
00038           if (isPiece(captured))
00039           {
00040             const Ptype ptype = unpromote(captured);
00041             result.trySub(ptype);
00042           }
00043         }
00044         return result;
00045       }
00046       static const PieceStand
00047       defense(const CheckMoveList& moves, const NumEffectState& state,
00048               PieceStand max);
00049     };
00050   
00051   } // namespace checkmate
00052 } // osl
00053 
00054 #endif /* _PROOFPIECES_H */
00055 // ;;; Local Variables:
00056 // ;;; mode:c++
00057 // ;;; c-basic-offset:2
00058 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines