safeMove.h
Go to the documentation of this file.
/* safeMove.h
*/
#ifndef OSL_MOVE_CLASSIFIER_SAFE_MOVE_H
#define OSL_MOVE_CLASSIFIER_SAFE_MOVE_H
#include "osl/move_classifier/kingOpenMove.h"
#include "osl/move_classifier/classifierTraits.h"
#include "osl/numEffectState.h"
namespace osl
{
namespace move_classifier
{
template <Player P>
struct SafeMove
{
static bool isMember(const NumEffectState& state,
Ptype ptype,Square from,Square to)
{
assert(! from.isPieceStand());
assert(state.pieceOnBoard(from).owner() == P);
if (ptype==KING)
return ! state.template hasEffectAt<alt(P)>(to);
return ! KingOpenMove<P>::isMember(state,ptype,from,to);
}
};
template <Player P> struct ClassifierTraits<SafeMove<P> >
{
static const bool drop_suitable = false;
static const bool result_if_drop = true;
};
}
}
#endif /* OSL_MOVE_CLASSIFIER_SAFE_MOVE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
classifierTraits.h
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::Piece::owner
Player owner() const
Definition basic_type.h:963
osl::SimpleState::pieceOnBoard
const Piece pieceOnBoard(Square sq) const
Definition simpleState.h:170
osl::Square
Definition basic_type.h:532
osl::Square::isPieceStand
bool isPieceStand() const
Definition basic_type.h:576
kingOpenMove.h
osl::move_classifier
Definition check_.h:10
osl
Definition additionalEffect.h:6
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
osl::KING
@ KING
Definition basic_type.h:93
numEffectState.h
osl::move_classifier::ClassifierTraits< SafeMove< P > >::drop_suitable
static const bool drop_suitable
Definition safeMove.h:36
osl::move_classifier::ClassifierTraits< SafeMove< P > >::result_if_drop
static const bool result_if_drop
Definition safeMove.h:37
osl::move_classifier::ClassifierTraits
Definition classifierTraits.h:11
osl::move_classifier::KingOpenMove::isMember
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 kingOpenMove.h:31
osl::move_classifier::SafeMove
元々，手番の玉に王手がかかっていない状態で自殺手でないことをチェック.
Definition safeMove.h:18
osl::move_classifier::SafeMove::isMember
static bool isMember(const NumEffectState &state, Ptype ptype, Square from, Square to)
Definition safeMove.h:19