44 for (
int l=0;l<8;l++) {
51 if ((dx != dx1 || dy != dy1)
68 for (
int l=0;l<8;l++) {
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;
109 const int liberty_count = misc::BitOp::countBit(liberty);
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++) {
147 int min_liberty = std::max(2,misc::BitOp::countBit(l))-1;
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;
155 min_liberty = std::min(min_liberty, std::min(pr,pb));
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++) {
168 int min_liberty = std::max(2,misc::BitOp::countBit(l))-1;
171 for (
int j=0; j<8; j++) {
178 Liberty e = liberties[l][k][j];
182 min_liberty = std::min(min_liberty, (
int)e.
liberty);
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++) {
196 int min_liberty = std::max(2,misc::BitOp::countBit(l))-1;
199 for (
int j=0; j<8; j++) {
210 Liberty e = liberties[l][k][j];
214 min_liberty = std::min(min_liberty, (
int)e.
liberty);
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++)
283 if (Neighboring8Direct::hasEffect(state, p.
ptypeO(), p.
square(),
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);
339 num_checks += misc::BitOp::countBit(info.
dropCandidate()) * drop_scale;
340 return std::max(1, num_checks);
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();
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)
384 if (target.
x() <= 1 || target.
x() >= 9 || target.
y() <=1 || target.
y() >=9)
static osl::SetUpRegister _initializer([](){ osl::Centering3x3::table.init();})
const Offset getOffset(Direction dir) const
int getDxForBlack(Direction dir) const
int getDyForBlack(Direction dir) const
uint64_t Iking8Info(Player king) const
bool hasEffectByPtype(Player attack, Square target) const
target に ptype の利きがあるか? 成不成を区別しない
const Square square() const
bool isOnBoardByOwner() const
piece がプレイヤーPの持ち物でかつボード上にある駒の場合は true.
const EffectContent getEffect(PtypeO ptypeo, Square from, Square to) const
fromにいるptypeoがtoに利きを持つか?
int getMoveMask(Ptype ptype) const
bool hasPieceOnStand(Player player, Ptype ptype) const
const Piece pieceOf(int num) const
Square kingSquare() const
unsigned int index() const
int y() const
将棋としてのY座標を返す.
const Square squareForBlack(Player player) const
int x() const
将棋としてのX座標を返す.
CArray2d< uint64_t, 2, Square::SIZE > edge_mask
unsigned int liberty() const
8-15 bit 目を 0-7bitにshiftして返す
unsigned int countMoveCandidate(NumEffectState const &state) const
unsigned int moveCandidateMask(NumEffectState const &state) const
unsigned int libertyDropMask() const
0-15bit
unsigned int dropCandidate() const
0-7 bit 目を返す
unsigned int libertyCount() const
libertyの数
証明数(proof number)と反証数(disproof number).
int libertyAfterAllDrop(const NumEffectState &state) const
drop のみ
const ProofDisproof attackEstimation(const NumEffectState &state) const
全て
int disproofAfterAllCheck(const NumEffectState &, Player, King8Info) const
int libertyAfterAllMove(const NumEffectState &state) const
移動 のみ
int libertyAfterAllCheck(const NumEffectState &state) const
全て
const Liberty countLiberty(Ptype ptype, Direction d, unsigned int liberty_mask) const
dir 方向からの王手をかけた時のlibertyの予想
ProofNumberTable Proof_Number_Table
const PtypeTable Ptype_Table
constexpr int dirToMask(Direction dir)
const BoardTable Board_Table
bool isPromoted(Ptype ptype)
ptypeがpromote後の型かどうかのチェック
constexpr bool isShort(Direction d)
constexpr bool isPiece(Ptype ptype)
ptypeが空白やEDGEでないかのチェック
bool isMajor(Ptype ptype)
constexpr bool isLong(Direction d)
constexpr Direction shortToLong(Direction d)
引数に longDirを与えてはいけない
constexpr Player alt(Player player)
PtypeO newPtypeO(Player player, Ptype ptype)
uint8_t liberty
玉の自由度の予測値.
bool has_effect
false の場合は必ず空き王手