My Project
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"
7namespace osl
8{
9 namespace checkmate
10 {
12 {
17 template <Player P>
19 Square from, Square to)
20 {
21 return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
22 && (from.canPromote<P>() || to.canPromote<P>());
23 }
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:
圧縮していない moveの表現 .
bool isPromotion() const
Ptype ptype() const
Player player() const
const Square to() const
const Square from() const
bool canPromote() const
Definition basic_type.h:659
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
@ ROOK
Definition basic_type.h:100
@ PPAWN
Definition basic_type.h:87
@ BISHOP
Definition basic_type.h:99
@ PROOK
Definition basic_type.h:92
@ PAWN
Definition basic_type.h:95
@ PBISHOP
Definition basic_type.h:91
Player
Definition basic_type.h:8
static bool hasParingNoPromote(Move m)
m を不成にした指手は打歩詰の時以外は試さなくて良い.
static bool effectiveOnlyIfPawnCheckmate(Move m)
static bool effectiveOnlyIfPawnCheckmate(Player a, Ptype ptype, Square from, Square to)
static bool hasParingNoPromote(bool isPromote, Ptype ptype)
static bool effectiveOnlyIfPawnCheckmate(Ptype ptype, Square from, Square to)
指手は打歩詰の時以外は試さなくて良い TODO: 敵陣2段目の香も打歩詰以外は成るべき