checkmate.h
Go to the documentation of this file.
/* checkmate.h
*/
#ifndef _CHECKMATE_H
#define _CHECKMATE_H
#include "osl/rating/feature.h"
#include "osl/checkmate/immediateCheckmate.h"
#include "osl/checkmate/checkmateIfCapture.h"
namespace osl
{
namespace rating
{
class CheckmateIfCapture : public Feature
{
public:
CheckmateIfCapture() : Feature("CC") {}
bool match(const NumEffectState& state, Move move, const RatingEnv&) const
{
return state.hasEffectAt(alt(move.player()), move.to())
&& checkmate::CheckmateIfCapture::effectiveAttackCandidate0(state, move)
&& checkmate::CheckmateIfCapture::effectiveAttack
(const_cast<NumEffectState&>(state), move, 0); // XXX: evil cast
}
};
class Threatmate : public Feature
{
public:
Threatmate() : Feature("Tm") {}
bool match(const NumEffectState& state, Move move, const RatingEnv&) const;
struct Helper;
static bool isCandidate(const NumEffectState& state, Move move);
static bool knight2Step(const NumEffectState& state, Move move, Square king);
static bool captureForKnightCheck(const NumEffectState& state, Move move, Square king);
};
}
}
#endif /* _CHECKMATE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
checkmateIfCapture.h
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::Move::player
Player player() const
Definition basic_type.h:1195
osl::Move::to
const Square to() const
Definition basic_type.h:1132
osl::NumEffectState
利きを持つ局面
Definition numEffectState.h:34
osl::NumEffectState::hasEffectAt
bool hasEffectAt(Square target) const
対象とするマスにあるプレイヤーの利きがあるかどうか.
Definition numEffectState.h:324
osl::Square
Definition basic_type.h:532
osl::rating::CheckmateIfCapture::CheckmateIfCapture
CheckmateIfCapture()
Definition checkmate.h:17
osl::rating::CheckmateIfCapture::match
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
Definition checkmate.h:18
osl::rating::Feature::Feature
Feature(const std::string &name)
Definition rating/feature.h:18
osl::rating::RatingEnv
Definition ratingEnv.h:16
osl::rating::Threatmate::match
bool match(const NumEffectState &state, Move move, const RatingEnv &) const
Definition checkmate.cc:94
osl::rating::Threatmate::isCandidate
static bool isCandidate(const NumEffectState &state, Move move)
Definition checkmate.cc:61
osl::rating::Threatmate::knight2Step
static bool knight2Step(const NumEffectState &state, Move move, Square king)
Definition checkmate.cc:25
osl::rating::Threatmate::Threatmate
Threatmate()
Definition checkmate.h:30
osl::rating::Threatmate::captureForKnightCheck
static bool captureForKnightCheck(const NumEffectState &state, Move move, Square king)
Definition checkmate.cc:36
immediateCheckmate.h
osl::rating
Definition construct.h:18
osl
Definition additionalEffect.h:6
osl::alt
constexpr Player alt(Player player)
Definition basic_type.h:13
feature.h
osl::checkmate::CheckmateIfCapture::effectiveAttackCandidate0
static bool effectiveAttackCandidate0(const NumEffectState &state, Move move)
depth==0でeffectiveAttackになる可能性がなければfalse
Definition checkmateIfCapture.cc:21
osl::checkmate::CheckmateIfCapture::effectiveAttack
static bool effectiveAttack(NumEffectState &state, Move move, int depth)
move を指した後，alt(move.player())が取ると詰みかどうか.
Definition checkmateIfCapture.cc:120