My Project
shouldPromoteCut.h
Go to the documentation of this file.
1/* shouldPromoteCut.h
2 */
3#ifndef _SEARCH_SHOULDPROMOTECUT_H
4#define _SEARCH_SHOULDPROMOTECUT_H
5
6#include "osl/basic_type.h"
8namespace osl
9{
17 {
18 template <Player P>
19 static bool canIgnore(Ptype ptype, Square from, Square to)
20 {
21 assert(! from.isPieceStand());
22 return (ptype==LANCE && (P==BLACK ? to.y()==2 : to.y()==8)) ||
23 (isBasic(ptype) && Ptype_Table.isBetterToPromote(ptype)
24 && (to.canPromote<P>() || from.canPromote<P>()));
25 }
29 template <Player Moving>
30 static bool canIgnoreMove(Move move)
31 {
32 assert(! move.isDrop());
33 return canIgnore<Moving>(move.ptype(), move.from(), move.to());
34 }
38 template <Player Moving>
39 static bool canIgnoreAndNotDrop(Move move)
40 {
41 return (! move.isDrop()) && canIgnoreMove<Moving>(move);
42 }
43 static bool canIgnoreAndNotDrop(Move move)
44 {
45 if (move.player() == BLACK)
46 return canIgnoreAndNotDrop<BLACK>(move);
47 else
48 return canIgnoreAndNotDrop<WHITE>(move);
49 }
50 };
51
52
53} // osl
54
55#endif /* _SHOULDPROMOTECUT_H */
56// ;;; Local Variables:
57// ;;; mode:c++
58// ;;; c-basic-offset:2
59// ;;; End:
圧縮していない moveの表現 .
Ptype ptype() const
Player player() const
bool isDrop() const
const Square to() const
const Square from() const
bool isBetterToPromote(Ptype ptype) const
Definition ptypeTable.h:58
bool isPieceStand() const
Definition basic_type.h:576
int y() const
将棋としてのY座標を返す.
Definition basic_type.h:567
bool canPromote() const
Definition basic_type.h:659
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
@ LANCE
Definition basic_type.h:96
const PtypeTable Ptype_Table
Definition tables.cc:97
@ BLACK
Definition basic_type.h:9
bool isBasic(Ptype ptype)
ptypeが基本型(promoteしていない)かのチェック
Definition basic_type.h:128
探索で前向き枝刈して良い条件を一時的に書いておく
static bool canIgnoreMove(Move move)
dropでないことが確定している場合
static bool canIgnoreAndNotDrop(Move move)
drop は通すチェック有り
static bool canIgnoreAndNotDrop(Move move)
static bool canIgnore(Ptype ptype, Square from, Square to)