shouldPromoteCut.h
Go to the documentation of this file.
/* shouldPromoteCut.h
*/
#ifndef _SEARCH_SHOULDPROMOTECUT_H
#define _SEARCH_SHOULDPROMOTECUT_H
#include "osl/basic_type.h"
#include "osl/bits/ptypeTable.h"
namespace osl
{
struct ShouldPromoteCut
{
template <Player P>
static bool canIgnore(Ptype ptype, Square from, Square to)
{
assert(! from.isPieceStand());
return (ptype==LANCE && (P==BLACK ? to.y()==2 : to.y()==8)) ||
(isBasic(ptype) && Ptype_Table.isBetterToPromote(ptype)
&& (to.canPromote<P>() || from.canPromote<P>()));
}
template <Player Moving>
static bool canIgnoreMove(Move move)
{
assert(! move.isDrop());
return canIgnore<Moving>(move.ptype(), move.from(), move.to());
}
template <Player Moving>
static bool canIgnoreAndNotDrop(Move move)
{
return (! move.isDrop()) && canIgnoreMove<Moving>(move);
}
static bool canIgnoreAndNotDrop(Move move)
{
if (move.player() == BLACK)
return canIgnoreAndNotDrop<BLACK>(move);
else
return canIgnoreAndNotDrop<WHITE>(move);
}
};
} // osl
#endif /* _SHOULDPROMOTECUT_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::Move::ptype
Ptype ptype() const
Definition basic_type.h:1155
osl::Move::player
Player player() const
Definition basic_type.h:1195
osl::Move::isDrop
bool isDrop() const
Definition basic_type.h:1150
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::isPieceStand
bool isPieceStand() const
Definition basic_type.h:576
osl::Square::y
int y() const
将棋としてのY座標を返す.
Definition basic_type.h:567
osl::Square::canPromote
bool canPromote() const
Definition basic_type.h:659
osl
Definition additionalEffect.h:6
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
osl::LANCE
@ LANCE
Definition basic_type.h:96
osl::Ptype_Table
const PtypeTable Ptype_Table
Definition tables.cc:97
osl::BLACK
@ BLACK
Definition basic_type.h:9
osl::isBasic
bool isBasic(Ptype ptype)
ptypeが基本型(promoteしていない)かのチェック
Definition basic_type.h:128
ptypeTable.h
osl::ShouldPromoteCut
探索で前向き枝刈して良い条件を一時的に書いておく
Definition shouldPromoteCut.h:17
osl::ShouldPromoteCut::canIgnoreMove
static bool canIgnoreMove(Move move)
dropでないことが確定している場合
Definition shouldPromoteCut.h:30
osl::ShouldPromoteCut::canIgnoreAndNotDrop
static bool canIgnoreAndNotDrop(Move move)
drop は通すチェック有り
Definition shouldPromoteCut.h:39
osl::ShouldPromoteCut::canIgnoreAndNotDrop
static bool canIgnoreAndNotDrop(Move move)
Definition shouldPromoteCut.h:43
osl::ShouldPromoteCut::canIgnore
static bool canIgnore(Ptype ptype, Square from, Square to)
Definition shouldPromoteCut.h:19