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);
99 const Liberty e = effectiveCheckLong(ptype,dir,i);
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)
143 for (
int l=0; l<0x100; l++) {
144 for (
int m=0; m<0x100; m++) {
150 for (
int j=0; j<8; j++) {
164 for (
int l=0; l<0x100; l++) {
165 for (
int m=0; m<0x100; m++) {
171 for (
int j=0; j<8; j++) {
192 for (
int l=0; l<0x100; l++) {
193 for (
int m=0; m<0x100; m++) {
199 for (
int j=0; j<8; j++) {
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);
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座標を返す.
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
全て
CArray2d< uint8_t, 0x100u, 0x100u > pmajor_liberty
龍や馬で王手をかけられる時のliberty: [liberty][move_mask]
int disproofAfterAllCheck(const NumEffectState &, Player, King8Info) const
CArray2d< uint8_t, 0x10000u, 8 > drop_liberty
全ての有効drop -> 最小liberty.
CArray2d< uint8_t, 0x100u, 0x100u > promote_liberty
王が1,2段目にいる時の移動王手によるliberty: [liberty][move_mask].
int libertyAfterAllMove(const NumEffectState &state) const
移動 のみ
int libertyAfterAllCheck(const NumEffectState &state) const
全て
CArray2d< CArray< Liberty, DIRECTION_SIZE >, 0x100u, PTYPE_SIZE > liberties
一つの王手 -> Liberty: long なdirection は1マスあけた王手を意味する
CArray2d< uint8_t, 0x100u, 0x100u > other_move_liberty
それ以外の移動liberty: [liberty][move_mask]
const Liberty countLiberty(Ptype ptype, Direction d, unsigned int liberty_mask) const
dir 方向からの王手をかけた時のlibertyの予想
static bool hasEffect(const NumEffectState &state, PtypeO ptypeo, Square from, Square target)
ptypeo の駒がfromからtargetの8近傍に直接の利きを持つか
ProofNumberTable Proof_Number_Table
int max(Player p, int v1, int v2)
int min(Player p, int v1, int v2)
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 の場合は必ず空き王手
static int countBit(Integer mask)