13 using namespace osl::checkmate;
17 const checkmate::ProofNumberTable::Liberty
31 for (
int l=0;l<8;l++) {
38 if ((dx != dx1 || dy != dy1)
44 const checkmate::ProofNumberTable::Liberty
55 for (
int l=0;l<8;l++) {
80 for (
int i=0; i<0x100; i++) {
84 for (
int j=0; j<8; j++) {
86 const Liberty e = effectiveCheckShort(ptype,dir,i);
87 table->liberties[i][k][j] = e;
92 const Liberty e = effectiveCheckLong(ptype,dir,i);
93 table->liberties[i][k][j] = e;
99 table->drop_liberty.fill(0);
100 for(
int i=0;i<0x10000;i++){
101 const unsigned int liberty = (i>>8)&0xff;
103 if (liberty_count <= 2)
107 int minimum_liberty = liberty_count;
111 for (
int j=0;j<8;j++) {
115 if ((i&(0x100<<j))!=0)
119 const bool has_effect
124 const int e =
table->liberties[liberty][k][j].liberty;
126 minimum_liberty =
std::min(minimum_liberty, e);
128 for (
int l=minimum_liberty; l<liberty_count; ++l)
130 table->drop_liberty[i][l] |= (1<<(ptype-
GOLD));
135 table->pmajor_liberty.fill(8);
136 for (
int l=0; l<0x100; l++) {
137 for (
int m=0; m<0x100; m++) {
143 for (
int j=0; j<8; j++) {
146 const int pr =
table->liberties[l][
PROOK][j].liberty;
152 table->pmajor_liberty[l][m] = min_liberty;
156 table->promote_liberty.fill(8);
157 for (
int l=0; l<0x100; l++) {
158 for (
int m=0; m<0x100; m++) {
164 for (
int j=0; j<8; j++) {
180 table->promote_liberty[l][m] = min_liberty;
184 table->other_move_liberty.fill(8);
185 for (
int l=0; l<0x100; l++) {
186 for (
int m=0; m<0x100; m++) {
192 for (
int j=0; j<8; j++) {
212 table->other_move_liberty[l][m] = min_liberty;
221 const Square king = state.kingSquare(
alt(attack));
223 return countLiberty(state, info.libertyCount(), move, king, info);
230 assert(state.turn() == attack);
235 uint8_t ptype_mask = 0;
237 ptype_mask |= state.hasPieceOnStand(attack, static_cast<Ptype>(p)) << (p-
GOLD);
240 && (ptype_mask & table->drop_liberty[ld_mask][result-1]);
250 const Player attack = state.turn();
252 return libertyAfterAllDrop(state, attack, info);
260 bool has_pmajor =
false;
263 i < PtypeTraits<ROOK>::indexLimit; i++)
266 const Piece p = state.pieceOf(i);
292 int result = table->pmajor_liberty[info.
liberty()][moveCandidate];
300 promoted_area = state.hasEffectByPtype<
GOLD>(attack, u);
304 int result = table->promote_liberty[info.
liberty()][moveCandidate];
308 int result = table->other_move_liberty[info.
liberty()][moveCandidate];
316 const Player attack = state.turn();
317 const Square king = state.kingSquare(
alt(attack));
319 return libertyAfterAllMove(state, attack, info, king);
329 int drop_scale = state.hasPieceOnStand<
GOLD>(attack)
330 + state.hasPieceOnStand<
SILVER>(attack);
341 int p = libertyAfterAllDrop(state, attack, info);
344 p =
std::min(p, libertyAfterAllMove(state, attack, info, king));
346 return ProofDisproof(p, disproofAfterAllCheck(state, attack, info));
352 const Player attack = state.turn();
353 const Square king = state.kingSquare(
alt(attack));
355 return attackEstimation(state, attack, info, king);
361 return attackEstimation(state).proof();