// Restrict mobility to actual squares of board
b &= pos.board_bb();
+ if (Pt == SOLDIER && pos.unpromoted_soldier(Us, s))
+ {
+ b &= file_bb(s);
+ score -= make_score(PieceValue[MG][Pt], PieceValue[EG][Pt]) / 3;
+ }
+
if (pos.blockers_for_king(Us) & s)
b &= LineBB[pos.square<KING>(Us)][s];
if (pos.captures_to_hand() && pos.count<KING>(Them) && pos.count<KING>(Us))
score -= KingProximity * distance(s, pos.square<KING>(Us)) * distance(s, pos.square<KING>(Them));
- if (Pt == SOLDIER && pos.unpromoted_soldier(Us, s))
- score -= make_score(PieceValue[MG][Pt], PieceValue[EG][Pt]) / 2;
-
if (Pt == BISHOP || Pt == KNIGHT)
{
// Bonus if piece is on an outpost square or can reach one
if (xiangqi_general())
b ^= b & pieces(KING) & ~PseudoAttacks[~c][WAZIR][s];
+ if (unpromoted_soldier(c, s))
+ b ^= b & pieces(SOLDIER) & ~PseudoAttacks[~c][SHOGI_PAWN][s];
+
return b;
}