My Project
safeMove.h
Go to the documentation of this file.
1/* safeMove.h
2 */
3#ifndef OSL_MOVE_CLASSIFIER_SAFE_MOVE_H
4#define OSL_MOVE_CLASSIFIER_SAFE_MOVE_H
8namespace osl
9{
10 namespace move_classifier
11 {
16 template <Player P>
17 struct SafeMove
18 {
19 static bool isMember(const NumEffectState& state,
20 Ptype ptype,Square from,Square to)
21 {
22 assert(! from.isPieceStand());
23 assert(state.pieceOnBoard(from).owner() == P);
28 if (ptype==KING)
29 return ! state.template hasEffectAt<alt(P)>(to);
30 return ! KingOpenMove<P>::isMember(state,ptype,from,to);
31 }
32 };
33
34 template <Player P> struct ClassifierTraits<SafeMove<P> >
35 {
36 static const bool drop_suitable = false;
37 static const bool result_if_drop = true;
38 };
39 }
40}
41#endif /* OSL_MOVE_CLASSIFIER_SAFE_MOVE_H */
42// ;;; Local Variables:
43// ;;; mode:c++
44// ;;; c-basic-offset:2
45// ;;; End:
利きを持つ局面
Player owner() const
Definition basic_type.h:963
const Piece pieceOnBoard(Square sq) const
bool isPieceStand() const
Definition basic_type.h:576
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
@ KING
Definition basic_type.h:93
static bool isMember(const NumEffectState &state, Ptype, Square from, Square to)
king が59 rookが51->61の時,差は OFFSET -8 -> U OFFSET +8 -> D とはなるので,一直線のような気がする.ただし,そもとも, 59 - 51はpinにはならな...
元々,手番の玉に王手がかかっていない状態で自殺手でないことをチェック.
Definition safeMove.h:18
static bool isMember(const NumEffectState &state, Ptype ptype, Square from, Square to)
Definition safeMove.h:19