26 using namespace osl::checkmate;
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);
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);
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++) {
155 min_liberty = std::min(min_liberty, std::min(pr,pb));
164 for (
int l=0; l<0x100; l++) {
165 for (
int m=0; m<0x100; m++) {
171 for (
int j=0; j<8; j++) {
182 min_liberty = std::min(min_liberty, (
int)e.
liberty);
192 for (
int l=0; l<0x100; l++) {
193 for (
int m=0; m<0x100; m++) {
199 for (
int j=0; j<8; j++) {
214 min_liberty = std::min(min_liberty, (
int)e.
liberty);
237 assert(state.
turn() == attack);
242 uint8_t ptype_mask = 0;
267 bool has_pmajor =
false;
270 i < PtypeTraits<ROOK>::indexLimit; i++)
340 return std::max(1, num_checks);
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();})
static bool hasEffect(const NumEffectState &state, PtypeO ptypeo, Square from, Square target)
ptypeo の駒がfromからtargetの8近傍に直接の利きを持つか
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.
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
全て
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の予想
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)
Offset32Base< 8, 9 > Offset32
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)