pawnCheckmateMoves.h
Go to the documentation of this file.
/* pawnCheckmateMoves.h
*/
#ifndef _PAWNCHECKMATEMOVES_H
#define _PAWNCHECKMATEMOVES_H
#include "osl/basic_type.h"
namespace osl
{
namespace checkmate
{
struct PawnCheckmateMoves
{
template <Player P>
static bool effectiveOnlyIfPawnCheckmate(Ptype ptype,
Square from, Square to)
{
return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
&& (from.canPromote<P>() || to.canPromote<P>());
}
static bool effectiveOnlyIfPawnCheckmate(Player a, Ptype ptype,
Square from, Square to)
{
return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
&& (from.canPromote(a) || to.canPromote(a));
}
static bool effectiveOnlyIfPawnCheckmate(Move m)
{
return effectiveOnlyIfPawnCheckmate(m.player(), m.ptype(),
m.from(), m.to());
}
static bool hasParingNoPromote(bool isPromote, Ptype ptype)
{
return isPromote
&& ((ptype == PPAWN) || (ptype == PROOK) || (ptype == PBISHOP));
}
static bool hasParingNoPromote(Move m)
{
return hasParingNoPromote(m.isPromotion(), m.ptype());
}
};
} // namespace checkmate
} // namespace osl
#endif /* _PAWNCHECKMATEMOVES_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::Move::isPromotion
bool isPromotion() const
Definition basic_type.h:1147
osl::Move::ptype
Ptype ptype() const
Definition basic_type.h:1155
osl::Move::player
Player player() const
Definition basic_type.h:1195
osl::Move::to
const Square to() const
Definition basic_type.h:1132
osl::Move::from
const Square from() const
Definition basic_type.h:1125
osl::Square
Definition basic_type.h:532
osl::Square::canPromote
bool canPromote() const
Definition basic_type.h:659
osl::checkmate
Definition king8Info.h:12
osl
Definition additionalEffect.h:6
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
osl::ROOK
@ ROOK
Definition basic_type.h:100
osl::PPAWN
@ PPAWN
Definition basic_type.h:87
osl::BISHOP
@ BISHOP
Definition basic_type.h:99
osl::PROOK
@ PROOK
Definition basic_type.h:92
osl::PAWN
@ PAWN
Definition basic_type.h:95
osl::PBISHOP
@ PBISHOP
Definition basic_type.h:91
osl::Player
Player
Definition basic_type.h:8
osl::checkmate::PawnCheckmateMoves
Definition pawnCheckmateMoves.h:12
osl::checkmate::PawnCheckmateMoves::hasParingNoPromote
static bool hasParingNoPromote(Move m)
m を不成にした指手は打歩詰の時以外は試さなくて良い.
Definition pawnCheckmateMoves.h:45
osl::checkmate::PawnCheckmateMoves::effectiveOnlyIfPawnCheckmate
static bool effectiveOnlyIfPawnCheckmate(Move m)
Definition pawnCheckmateMoves.h:30
osl::checkmate::PawnCheckmateMoves::effectiveOnlyIfPawnCheckmate
static bool effectiveOnlyIfPawnCheckmate(Player a, Ptype ptype, Square from, Square to)
Definition pawnCheckmateMoves.h:24
osl::checkmate::PawnCheckmateMoves::hasParingNoPromote
static bool hasParingNoPromote(bool isPromote, Ptype ptype)
Definition pawnCheckmateMoves.h:36
osl::checkmate::PawnCheckmateMoves::effectiveOnlyIfPawnCheckmate
static bool effectiveOnlyIfPawnCheckmate(Ptype ptype, Square from, Square to)
指手は打歩詰の時以外は試さなくて良い TODO: 敵陣2段目の香も打歩詰以外は成るべき
Definition pawnCheckmateMoves.h:18