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