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