Go to the documentation of this file.
28 int countShort(
PtypeO ptypeO,
int center_dx,
int center_dy){
48 LongEffect calcLong(
Direction d,
int center_dx,
int center_dy){
58 assert(dx!=0 || dy!=0);
62 if(dx_min<=dx*i && dx*i <=dx_max &&
63 dy_min<=dy*i && dy*i <=dy_max)
break;
68 if(!(dx_min<=dx*i && dx*i <=dx_max &&
69 dy_min<=dy*i && dy*i <=dy_max))
break;
72 ret.offset=Offset(dx,dy);
73 assert(!ret.offset.zero());
98 ret[index]=calcLong(longD,center_dx,center_dy);
99 if(!ret[index].offset.zero())index++;
107 return os <<
"(" << longEffect.
offset <<
"," << longEffect.
minIndex
108 <<
"," << longEffect.
maxIndex <<
")";
134 for(
int i=0;i<2;i++,pl=
alt(pl)){
137 for(
int dy= -8;dy<=8;dy++)
138 for(
int dx= -8;dx<=8;dx++){
141 countShort(ptypeO,dx,dy);
149 for(
int i=0;i<2;i++,pl=
alt(pl)){
150 for(
int j=0;j<8;j++){
152 for(
int dy= -8;dy<=8;dy++)
153 for(
int dx= -8;dx<=8;dx++){
155 blockEffect[j][o32.
index()]=
164 for(
int i=0;i<2;i++,pl=
alt(pl)){
167 for(
int dy= -8;dy<=8;dy++)
168 for(
int dx= -8;dx<=8;dx++){
171 calcLong4(ptypeO,dx,dy);
181 for(
int x=1;x<=9;x++)
182 for(
int y=1;y<=9;y++){
185 for(
int dx=0;dx<5;dx++){
186 for(
int dy=0;dy<3;dy++){
187 const Square p(center.
x()+dx-2,center.
y()+dy-1);
188 int val=16-std::abs(p.
x()-king.
x());
189 attackEffect[
BLACK][king.
index()][dx*3+dy]=val;
193 for(
int x=1;x<=9;x++)
194 for(
int y=1;y<=9;y++){
197 for(
int dx=0;dx<5;dx++){
198 for(
int dy=0;dy<3;dy++){
199 int r_dx=4-dx,r_dy=2-dy;
201 attackEffect[
BLACK][r_king.
index()][r_dx*3+r_dy];
210 for(
int x=1;x<=9;x++)
211 for(
int y=1;y<=9;y++){
214 for(
int dx=0;dx<5;dx++){
215 for(
int dy=0;dy<3;dy++){
216 const Square p(center.
x()+dx-2,center.
y()+dy-1);
217 int val=16-std::abs(p.
x()-king.
x());
218 defenseEffect[
WHITE][king.
index()][dx*3+dy]=val;
222 for(
int x=1;x<=9;x++)
223 for(
int y=1;y<=9;y++){
226 for(
int dx=0;dx<5;dx++){
227 for(
int dy=0;dy<3;dy++){
228 int r_dx=4-dx,r_dy=2-dy;
230 defenseEffect[
WHITE][r_king.
index()][r_dx*3+r_dy];
243 setupDefenseEffect();
Effect5x3Table Effect5x3_Table
int min(Player p, int v1, int v2)
static osl::SetUpRegister _initializer([](){ osl::progress::Effect5x3_Table.init();})
const BoardTable Board_Table
constexpr Player alt(Player player)
const EffectContent getEffect(PtypeO ptypeo, Square from, Square to) const
fromにいるptypeoがtoに利きを持つか?
static const Square adjustCenter(Square src)
CArray< LongEffect, 4 > LongEffect4
長い利きの方向は高々4なので,長さ4のCArrayで表現.
Offset32Base< 8, 9 > Offset32
Ptype getPtype(PtypeO ptypeO)
void setupDefenseEffect()
std::ostream & operator<<(std::ostream &os, LongEffect const &longEffect)
Direction getLongDirection(Offset32 offset32) const
PtypeO newPtypeO(Player player, Ptype ptype)
Player getOwner(PtypeO ptypeO)
const PtypeTable Ptype_Table
int getDyForBlack(Direction dir) const
int getMoveMask(Ptype ptype) const
int max(Player p, int v1, int v2)
unsigned int index() const
int getDxForBlack(Direction dir) const
constexpr Direction shortToLong(Direction d)
引数に longDirを与えてはいけない
int x() const
将棋としてのX座標を返す.
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
int y() const
将棋としてのY座標を返す.
constexpr int sign(Player player)
unsigned int index() const
CArray< unsigned int, PTYPE_SIZE > onStand
unsigned int ptypeOIndex(PtypeO ptypeo)
const Square rotate180() const
static const EffectContent DIRECT()
5x3領域への長い利きの始まりと終わり. offset - 利きの方向が0の時は利きが無いことを示す minIndex - 利きが領域に入るindex maxIndex - 利きが領域から出る手前のin...
constexpr int dirToMask(Direction dir)
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す