All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pawnCheckmateMoves.h
Go to the documentation of this file.
1 /* pawnCheckmateMoves.h
2  */
3 #ifndef _PAWNCHECKMATEMOVES_H
4 #define _PAWNCHECKMATEMOVES_H
5 
6 #include "osl/move.h"
7 namespace osl
8 {
9  namespace checkmate
10  {
12  {
17  template <Player P>
18  static bool effectiveOnlyIfPawnCheckmate(Ptype ptype,
19  Square from, Square to)
20  {
21  return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
22  && (from.canPromote<P>() || to.canPromote<P>());
23  }
24  static bool effectiveOnlyIfPawnCheckmate(Player a, Ptype ptype,
25  Square from, Square to)
26  {
27  return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
28  && (from.canPromote(a) || to.canPromote(a));
29  }
31  {
33  m.from(), m.to());
34  }
35 
36  static bool hasParingNoPromote(bool isPromote, Ptype ptype)
37  {
38  return isPromote
39  && ((ptype == PPAWN) || (ptype == PROOK) || (ptype == PBISHOP));
40  }
45  static bool hasParingNoPromote(Move m)
46  {
47  return hasParingNoPromote(m.isPromotion(), m.ptype());
48  }
49  };
50  } // namespace checkmate
51 } // namespace osl
52 
53 #endif /* _PAWNCHECKMATEMOVES_H */
54 // ;;; Local Variables:
55 // ;;; mode:c++
56 // ;;; c-basic-offset:2
57 // ;;; End: