Go to the documentation of this file.
30 const checkmate::ProofNumberTable::Liberty
36 return ProofNumberTable::Liberty(0,
false);
44 for (
int l=0;l<8;l++) {
51 if ((dx != dx1 || dy != dy1)
55 return ProofNumberTable::Liberty(
std::max(count,1), has_effect);
57 const checkmate::ProofNumberTable::Liberty
68 for (
int l=0;l<8;l++) {
78 return ProofNumberTable::Liberty(
std::max(count,1), has_effect);
87 for (
int i=0; i<0x100; i++) {
91 for (
int j=0; j<8; j++) {
93 const Liberty e = effectiveCheckShort(ptype,dir,i);
94 liberties[i][k][j] = e;
99 const Liberty e = effectiveCheckLong(ptype,dir,i);
100 liberties[i][k][j] = e;
106 drop_liberty.fill(0);
107 for(
int i=0;i<0x10000;i++){
108 const unsigned int liberty = (i>>8)&0xff;
110 if (liberty_count <= 2)
114 int minimum_liberty = liberty_count;
118 for (
int j=0;j<8;j++) {
122 if ((i&(0x100<<j))!=0)
126 const bool has_effect
131 const int e = liberties[liberty][k][j].liberty;
133 minimum_liberty =
std::min(minimum_liberty, e);
135 for (
int l=minimum_liberty; l<liberty_count; ++l)
137 drop_liberty[i][l] |= (1<<(ptype-
GOLD));
142 pmajor_liberty.fill(8);
143 for (
int l=0; l<0x100; l++) {
144 for (
int m=0; m<0x100; m++) {
150 for (
int j=0; j<8; j++) {
153 const int pr = liberties[l][
PROOK][j].liberty;
154 const int pb = liberties[l][
PBISHOP][j].liberty;
159 pmajor_liberty[l][m] = min_liberty;
163 promote_liberty.fill(8);
164 for (
int l=0; l<0x100; l++) {
165 for (
int m=0; m<0x100; m++) {
171 for (
int j=0; j<8; j++) {
178 Liberty e = liberties[l][k][j];
187 promote_liberty[l][m] = min_liberty;
191 other_move_liberty.fill(8);
192 for (
int l=0; l<0x100; l++) {
193 for (
int m=0; m<0x100; m++) {
199 for (
int j=0; j<8; j++) {
210 Liberty e = liberties[l][k][j];
219 other_move_liberty[l][m] = min_liberty;
230 return countLiberty(state, info.
libertyCount(), move, king, info);
237 assert(state.
turn() == attack);
242 uint8_t ptype_mask = 0;
247 && (ptype_mask & drop_liberty[ld_mask][result-1]);
259 return libertyAfterAllDrop(state, attack, info);
267 bool has_pmajor =
false;
270 i < PtypeTraits<ROOK>::indexLimit; i++)
299 int result = pmajor_liberty[info.
liberty()][moveCandidate];
311 int result = promote_liberty[info.
liberty()][moveCandidate];
315 int result = other_move_liberty[info.
liberty()][moveCandidate];
326 return libertyAfterAllMove(state, attack, info, king);
348 int p = libertyAfterAllDrop(state, attack, info);
351 p =
std::min(p, libertyAfterAllMove(state, attack, info, king));
353 return ProofDisproof(p, disproofAfterAllCheck(state, attack, info));
362 return attackEstimation(state, attack, info, king);
368 return attackEstimation(state).proof();
375 edge_mask.fill(~(0xfull << 48));
376 for (
int x=1; x<=9; ++x) {
377 for (
int y=1; y<=9; ++y) {
381 if (target.
x() <= 1 || target.
x() >= 9 || target.
y() <=1 || target.
y() >=9)
382 edge_mask[
BLACK][king.
index()] &= ~(0x100ull<<d);
384 if (target.
x() <= 1 || target.
x() >= 9 || target.
y() <=1 || target.
y() >=9)
385 edge_mask[
WHITE][king.
index()] &= ~(0x100ull<<d);
uint8_t liberty
玉の自由度の予測値.
bool isMajor(Ptype ptype)
unsigned int liberty() const
8-15 bit 目を 0-7bitにshiftして返す
int min(Player p, int v1, int v2)
const BoardTable Board_Table
uint64_t Iking8Info(Player king) const
constexpr Player alt(Player player)
const EffectContent getEffect(PtypeO ptypeo, Square from, Square to) const
fromにいるptypeoがtoに利きを持つか?
Offset32Base< 8, 9 > Offset32
static osl::SetUpRegister _initializer([](){ osl::Centering3x3::table.init();})
const ProofDisproof attackEstimation(const NumEffectState &state) const
全て
constexpr bool isShort(Direction d)
PtypeO newPtypeO(Player player, Ptype ptype)
unsigned int countMoveCandidate(NumEffectState const &state) const
const PtypeTable Ptype_Table
int getDyForBlack(Direction dir) const
unsigned int dropCandidate() const
0-7 bit 目を返す
int getMoveMask(Ptype ptype) const
int max(Player p, int v1, int v2)
const Piece pieceOf(int num) const
unsigned int libertyCount() const
libertyの数
int libertyAfterAllDrop(const NumEffectState &state) const
drop のみ
int libertyAfterAllMove(const NumEffectState &state) const
移動 のみ
unsigned int index() const
int getDxForBlack(Direction dir) const
constexpr Direction shortToLong(Direction d)
引数に longDirを与えてはいけない
bool isOnBoardByOwner() const
piece がプレイヤーPの持ち物でかつボード上にある駒の場合は true.
bool has_effect
false の場合は必ず空き王手
bool hasPieceOnStand(Player player, Ptype ptype) const
int x() const
将棋としてのX座標を返す.
static int countBit(Integer mask)
const Offset getOffset(Direction dir) const
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
Square kingSquare() const
ProofNumberTable Proof_Number_Table
int y() const
将棋としてのY座標を返す.
int libertyAfterAllCheck(const NumEffectState &state) const
全て
constexpr bool isLong(Direction d)
bool isPromoted(Ptype ptype)
ptypeがpromote後の型かどうかのチェック
const Square square() const
int disproofAfterAllCheck(const NumEffectState &, Player, King8Info) const
証明数(proof number)と反証数(disproof number).
unsigned int moveCandidateMask(NumEffectState const &state) const
unsigned int libertyDropMask() const
0-15bit
static bool hasEffect(const NumEffectState &state, PtypeO ptypeo, Square from, Square target)
ptypeo の駒がfromからtargetの8近傍に直接の利きを持つか
bool hasEffectByPtype(Player attack, Square target) const
target に ptype の利きがあるか? 成不成を区別しない
const Liberty countLiberty(Ptype ptype, Direction d, unsigned int liberty_mask) const
dir 方向からの王手をかけた時のlibertyの予想
const Square squareForBlack(Player player) const
constexpr int dirToMask(Direction dir)