kingOpenMove.h
Go to the documentation of this file.
/* kingOpenMove.h
*/
#ifndef OSL_MOVE_CLASSIFIER_KING_OPEN_MOVE_H
#define OSL_MOVE_CLASSIFIER_KING_OPEN_MOVE_H
#include "osl/move_classifier/classifierTraits.h"
#include "osl/numEffectState.h"
namespace osl
{
namespace move_classifier
{
template <Player P>
struct KingOpenMove
{
static bool isMember(const NumEffectState& state,
Ptype /*ptype*/,Square from,Square to)
{
int num=state.pieceAt(from).number();
assert(Piece::isPieceNum(num));
if(!state.pinOrOpen(P).test(num)) return false;
// from to kingが一直線に並べば false
Square king=state.kingSquare<P>();
return Board_Table.getShort8Unsafe<P>(king,to)
!= Board_Table.getShort8<P>(king,from);
}
static bool isMember(const NumEffectState& state,
Ptype ptype,Square from,Square to,
Square exceptFor)
{
return isMemberMain<true>(state, ptype, from, to, exceptFor);
}
private:
template <bool hasException>
static bool
#ifdef __GNUC__
__attribute__ ((pure))
#endif
isMemberMain(const NumEffectState& state,
Ptype ptype,Square from,Square to,
Square exceptFor);
};
template <Player P> struct ClassifierTraits<KingOpenMove<P> >
{
static const bool drop_suitable = false;
static const bool result_if_drop = false;
};
} // namespace move_classifier
} // namespace osl
#endif /* OSL_MOVE_CLASSIFIER_NOT_KING_OPEN_MOVE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
classifierTraits.h
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::NumEffectState::pinOrOpen
PieceMask pinOrOpen(Player king) const
Definition numEffectState.h:74
osl::PieceMask::test
bool test(int num) const
Definition pieceMask.h:45
osl::Piece::isPieceNum
static bool isPieceNum(int num)
Definition basic_type.h:926
osl::Piece::number
int number() const
Definition basic_type.h:828
osl::SimpleState::kingSquare
Square kingSquare() const
Definition simpleState.h:94
osl::SimpleState::pieceAt
const Piece pieceAt(Square sq) const
Definition simpleState.h:167
osl::Square
Definition basic_type.h:532
osl::move_classifier
Definition check_.h:10
osl
Definition additionalEffect.h:6
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
osl::Board_Table
const BoardTable Board_Table
Definition tables.cc:95
osl::__attribute__
const PtypeO PTYPEO_EDGE __attribute__((unused))
numEffectState.h
osl::move_classifier::ClassifierTraits< KingOpenMove< P > >::result_if_drop
static const bool result_if_drop
Definition kingOpenMove.h:65
osl::move_classifier::ClassifierTraits< KingOpenMove< P > >::drop_suitable
static const bool drop_suitable
Definition kingOpenMove.h:64
osl::move_classifier::ClassifierTraits
Definition classifierTraits.h:11
osl::move_classifier::KingOpenMove
Pの王をopen checkにする手でないことをチェック.
Definition kingOpenMove.h:22
osl::move_classifier::KingOpenMove::isMemberMain
static bool isMemberMain(const NumEffectState &state, Ptype ptype, Square from, Square to, Square exceptFor)
Definition kingOpenMove.cc:7
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::KingOpenMove::isMember
static bool isMember(const NumEffectState &state, Ptype ptype, Square from, Square to, Square exceptFor)
Definition kingOpenMove.h:45