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/basic_type.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:
static bool hasParingNoPromote(Move m)
m を不成にした指手は打歩詰の時以外は試さなくて良い.
static bool hasParingNoPromote(bool isPromote, Ptype ptype)
static bool effectiveOnlyIfPawnCheckmate(Move m)
Ptype
駒の種類を4ビットでコード化する
Definition: basic_type.h:83
Ptype ptype() const
Definition: basic_type.h:1155
static bool effectiveOnlyIfPawnCheckmate(Ptype ptype, Square from, Square to)
指手は打歩詰の時以外は試さなくて良い TODO: 敵陣2段目の香も打歩詰以外は成るべき
static bool effectiveOnlyIfPawnCheckmate(Player a, Ptype ptype, Square from, Square to)
const Square from() const
Definition: basic_type.h:1125
圧縮していない moveの表現 .
Definition: basic_type.h:1051
Player player() const
Definition: basic_type.h:1195
const Square to() const
Definition: basic_type.h:1132
bool isPromotion() const
Definition: basic_type.h:1147
Player
Definition: basic_type.h:8
bool canPromote() const
Definition: basic_type.h:659