pawnCheckmateMoves.h
Go to the documentation of this file.
00001 /* pawnCheckmateMoves.h
00002  */
00003 #ifndef _PAWNCHECKMATEMOVES_H
00004 #define _PAWNCHECKMATEMOVES_H
00005 
00006 #include "osl/move.h"
00007 namespace osl
00008 {
00009   namespace checkmate
00010   {
00011     struct PawnCheckmateMoves
00012     {
00017       template <Player P>
00018       static bool effectiveOnlyIfPawnCheckmate(Ptype ptype, 
00019                                                Square from, Square to)
00020       {
00021         return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
00022           && (from.canPromote<P>() || to.canPromote<P>());
00023       }
00024       static bool effectiveOnlyIfPawnCheckmate(Player a, Ptype ptype, 
00025                                                Square from, Square to)
00026       {
00027         return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
00028           && (from.canPromote(a) || to.canPromote(a));
00029       }
00030       static bool effectiveOnlyIfPawnCheckmate(Move m)
00031       {
00032         return effectiveOnlyIfPawnCheckmate(m.player(), m.ptype(),
00033                                             m.from(), m.to());
00034       }
00035       
00036       static bool hasParingNoPromote(bool isPromote, Ptype ptype)
00037       {
00038         return isPromote
00039           && ((ptype == PPAWN) || (ptype == PROOK) || (ptype == PBISHOP));
00040       }
00045       static bool hasParingNoPromote(Move m)
00046       {
00047         return hasParingNoPromote(m.isPromotion(), m.ptype());
00048       }
00049     };
00050   } // namespace checkmate
00051 } // namespace osl
00052 
00053 #endif /* _PAWNCHECKMATEMOVES_H */
00054 // ;;; Local Variables:
00055 // ;;; mode:c++
00056 // ;;; c-basic-offset:2
00057 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines