28 int countShort(
PtypeO ptypeO,
int center_dx,
int center_dy){
30 for(
int dy=std::max(-8,center_dy-1);
31 dy<=std::min(8,center_dy+1);dy++)
32 for(
int dx=std::max(-8,center_dx-2);
33 dx<=std::min(8,center_dx+2);dx++){
48 LongEffect calcLong(
Direction d,
int center_dx,
int center_dy){
52 int dy_min=std::max(-8,center_dy-1);
53 int dy_max=std::min(8,center_dy+1);
54 int dx_min=std::max(-8,center_dx-2);
55 int dx_max=std::min(8,center_dx+2);
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();
int getDxForBlack(Direction dir) const
int getDyForBlack(Direction dir) const
Direction getLongDirection(Offset32 offset32) const
static const EffectContent DIRECT()
unsigned int index() const
const EffectContent getEffect(PtypeO ptypeo, Square from, Square to) const
fromにいるptypeoがtoに利きを持つか?
int getMoveMask(Ptype ptype) const
unsigned int index() const
int y() const
将棋としてのY座標を返す.
const Square rotate180() const
int x() const
将棋としてのX座標を返す.
CArray< unsigned int, PTYPE_SIZE > onStand
void setupDefenseEffect()
static osl::SetUpRegister _initializer([](){ osl::progress::Effect5x3_Table.init();})
std::ostream & operator<<(std::ostream &os, LongEffect const &longEffect)
CArray< LongEffect, 4 > LongEffect4
長い利きの方向は高々4なので,長さ4のCArrayで表現.
Effect5x3Table Effect5x3_Table
const PtypeTable Ptype_Table
Ptype getPtype(PtypeO ptypeO)
constexpr int dirToMask(Direction dir)
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す
const BoardTable Board_Table
Player getOwner(PtypeO ptypeO)
unsigned int ptypeOIndex(PtypeO ptypeo)
Offset32Base< 8, 9 > Offset32
constexpr int sign(Player player)
PtypeO
Player + Ptype [-15, 15] PtypeO の O は Owner の O.
constexpr Direction shortToLong(Direction d)
引数に longDirを与えてはいけない
constexpr Player alt(Player player)
PtypeO newPtypeO(Player player, Ptype ptype)
static const Square adjustCenter(Square src)
5x3領域への長い利きの始まりと終わり. offset - 利きの方向が0の時は利きが無いことを示す minIndex - 利きが領域に入るindex maxIndex - 利きが領域から出る手前のin...