3#ifndef OSL_PTYPETRAITS_H
4#define OSL_PTYPETRAITS_H
20 static const bool betterToPromote=
false;
21 static const char *
name() {
return "PTYPE_EMPTY";}
22 static const char *
csaName() {
return "..";}
23 static const int moveMask=0;
31 static const bool betterToPromote=
false;
32 static const char *
name() {
return "PTYPE_EDGE";}
33 static const char *
csaName() {
return "XX";}
34 static const int moveMask=0;
42 static const bool betterToPromote=
false;
44 static const char *
name() {
return "GOLD";}
45 static const char *
csaName() {
return "KI";}
46 static const int indexMin=26;
47 static const int indexLimit=30;
48 static const int dropBlackFromY=1;
49 static const int dropBlackToY=9;
51 static const int moveMask=
62 static const bool betterToPromote=
true;
65 static const char *
name() {
return "PAWN";}
66 static const char *
csaName() {
return "FU";}
67 static const int indexMin=0;
68 static const int indexLimit=18;
69 static const int dropBlackFromY=2;
70 static const int dropBlackToY=9;
71 static const int mayPromoteToY=4;
81 static const bool betterToPromote=
true;
83 static const char *
name() {
return "PPAWN";}
84 static const char *
csaName() {
return "TO";}
95 static const bool betterToPromote=
false;
98 static const char *
name() {
return "LANCE";}
99 static const char *
csaName() {
return "KY";}
100 static const int indexMin=32;
101 static const int indexLimit=36;
102 static const int dropBlackFromY=2;
103 static const int dropBlackToY=9;
104 static const int mayPromoteToY=9;
113 static const bool betterToPromote=
false;
115 static const char *
name() {
return "PLANCE";}
127 static const bool betterToPromote=
false;
130 static const char *
name() {
return "KNIGHT";}
132 static const int indexMin=18;
133 static const int indexLimit=22;
134 static const int dropBlackFromY=3;
135 static const int dropBlackToY=9;
136 static const int mayPromoteToY=5;
145 static const bool betterToPromote=
false;
147 static const char *
name() {
return "PKNIGHT";}
159 static const bool betterToPromote=
false;
162 static const char *
name() {
return "SILVER";}
164 static const int indexMin=22;
165 static const int indexLimit=26;
166 static const int dropBlackFromY=1;
167 static const int dropBlackToY=9;
168 static const int mayPromoteToY=4;
169 static const int moveMask=
180 static const bool betterToPromote=
false;
182 static const char *
name() {
return "PSILVER";}
194 static const bool betterToPromote=
true;
197 static const char *
name() {
return "BISHOP";}
199 static const int indexMin=36;
200 static const int indexLimit=38;
201 static const int dropBlackFromY=1;
202 static const int dropBlackToY=9;
203 static const int mayPromoteToY=9;
204 static const int moveMask=
215 static const bool betterToPromote=
true;
217 static const char *
name() {
return "PBISHOP";}
219 static const int moveMask=
233 static const bool betterToPromote=
true;
236 static const char *
name() {
return "ROOK";}
238 static const int indexMin=38;
239 static const int indexLimit=40;
240 static const int dropBlackFromY=1;
241 static const int dropBlackToY=9;
242 static const int mayPromoteToY=9;
243 static const int moveMask=
254 static const bool betterToPromote=
true;
256 static const char *
name() {
return "PROOK";}
258 static const int moveMask=
273 static const bool betterToPromote=
false;
276 static const char *
name() {
return "KING";}
278 static const int indexMin=30;
279 static const int indexLimit=32;
280 static const int dropBlackFromY=1;
281 static const int dropBlackToY=9;
282 static const int moveMask=
289 template<Ptype T,
bool IsBasic>
296 static const Ptype promotePtype=
static_cast<Ptype>(
static_cast<int>(T)-8);
303 static const uint64_t indexMask=
static_cast<uint64_t
>(0);
312#if OSL_WORDSIZE == 64
313 static const unsigned int indexNum=0;
314#elif OSL_WORDSIZE == 32
338 template<Ptype T,Direction D>
361 template<Ptype T,Player P>
414 else return pos.
yLe<3>();
419 else return pos.
yGe<7>();
std::enable_if< Y!=7, bool >::type yGe()
int y() const
将棋としてのY座標を返す.
static int reverseY(int y)
std::enable_if< Y!=2, bool >::type yLe()
bool canPromote(Ptype ptype)
ptypeがpromote可能な型かどうかのチェック promote済みの場合はfalseを返す
constexpr int playerToIndex(Player player)
bool isBasic(Ptype ptype)
ptypeが基本型(promoteしていない)かのチェック
MoveConstraint
ある方向にある駒が移動可能かを表す.
@ NoConstraint
promoteしていようが,いまいが可能
@ OnlyBasic
promoteしていない駒の場合にのみ可能
@ OnlyPromoted
promote済みの駒の場合にのみ可能
static const bool hasMove
static const bool canMove
static const MoveConstraint moveConstraint
static const Ptype promotePtype
static const Ptype basicType
static const uint64_t indexMask
static const bool hasLongMove
static bool canDropTo(Square pos)
static bool checkPromote(Square pos)
posにあるTの駒がpromote可能なdirectionに動く時だけpromote可能 shortの時はその時のみYES
static bool canPromote(Square pos)
posにあるTの駒がどの方向に動いてもpromote可能
static bool mayPromote(Square pos)
posにある駒がpromoteする可能性があるか? 先手BISHOPが49,58,59,69などにいる場合は可能性がないが,この時点では排除しない
static bool noPromote(Square pos)
posにあるTの駒は次に絶対にpromoteできない
static bool mustPromote(Square pos)
posにあるTの駒がpromoteする手しかない
static const char * name()
static const char * csaName()
static const char * csaName()
static const char * name()
static const char * name()
static const char * csaName()
static const char * csaName()
static const char * name()
static const char * csaName()
static const char * name()
static const char * csaName()
static const char * name()
static const char * csaName()
static const char * name()
static const char * csaName()
static const char * name()
static const char * name()
static const char * csaName()
static const char * csaName()
static const char * name()
static const char * name()
static const char * csaName()
static const char * csaName()
static const char * name()
static const char * csaName()
static const char * name()
static const char * name()
static const char * csaName()
static const char * name()
static const char * csaName()
static const char * csaName()
static const char * name()