13   for (
size_t i=0; i<weights.
dimension(); ++i)
 
   14     table[i] = weights.
value(i);
 
   16   for (
int x=1; x<=5; ++x)
 
   18     for (
int y=1; y<=3; ++y)
 
   21       const int king = indexKing(
WHITE, 
Square(x,y), flipx);
 
   22       for (
int i=0; i<45*7; ++i)
 
   23         for (
int j=i+1; j<45*7; ++j)
 
   24           table[composeIndex(king, j, i)] = table[composeIndex(king, i, j)];
 
   33   ret[
BLACK] = evalOne<BLACK>(state);
 
   34   ret[
WHITE] = evalOne<WHITE>(state);
 
   38 template <osl::Player King>
 
   42   FixedCapacityVector<Piece,38> pieces;
 
   43   if (state.template kingSquare<King>().template squareForBlack<King>().y() < 7)
 
   46   PieceMask bitset = state.piecesOnBoard(King) & ~state.promotedPieces();
 
   47   bitset.clearBit<
KING>();
 
   48   while (! bitset.none()) 
 
   50     const Piece p = state.pieceOf(bitset.takeOneBit());
 
   56   const int index_king = indexKing(King, state.kingSquare(King), flipx);
 
   59     for (
size_t i=0; i<pieces.size(); ++i)
 
   61       const unsigned int i0 = indexPiece<true>(King, pieces[i].square(), pieces[i].ptype());
 
   62       for (
size_t j=i+1; j<pieces.size(); ++j)
 
   64         const unsigned int i1 = indexPiece<true>(King, pieces[j].square(), pieces[j].ptype());
 
   65         const unsigned int index = composeIndex(index_king, i0, i1);
 
   72     for (
size_t i=0; i<pieces.size(); ++i)
 
   74       const unsigned int i0 = indexPiece<false>(King, pieces[i].square(), pieces[i].ptype());
 
   75       for (
size_t j=i+1; j<pieces.size(); ++j)
 
   77         const unsigned int i1 = indexPiece<false>(King, pieces[j].square(), pieces[j].ptype());
 
   78         const unsigned int index = composeIndex(index_king, i0, i1);
 
   83   return (King == 
BLACK) ? sum : -sum;
 
   86 template <osl::Player King>
 
   90   const Square king = state.kingSquare(King);
 
   92   const int index_king = indexKing(King, king, flipx);
 
   94   PieceMask bitset = state.piecesOnBoard(King) & ~state.promotedPieces();
 
   95   bitset.clearBit<
KING>();
 
   99     i0 = indexPiece<true>(King, to, ptype);
 
  100     while (! bitset.none()) 
 
  102       const Piece p = state.pieceOf(bitset.takeOneBit());
 
  105       const unsigned int i1 = indexPiece<true>(King, p.
square(), p.
ptype());
 
  106       const unsigned int index = composeIndex(index_king, i0, i1);
 
  112     i0 = indexPiece<false>(King, to, ptype);
 
  113     while (! bitset.none()) 
 
  115       const Piece p = state.pieceOf(bitset.takeOneBit());
 
  118       const unsigned int i1 = indexPiece<false>(King, p.
square(), p.
ptype());
 
  119       const unsigned int index = composeIndex(index_king, i0, i1);
 
  123   sum -= table[composeIndex(index_king, i0, i0)];
 
  124   return (King == 
BLACK) ? sum : -sum;
 
  126 template <osl::Player King>
 
  130   const Square king = state.kingSquare(King);
 
  132   const int index_king = indexKing(King, king, flipx);
 
  134   PieceMask bitset = state.piecesOnBoard(King) & ~state.promotedPieces();
 
  135   bitset.clearBit<
KING>();
 
  138     const unsigned int i0 = indexPiece<true>(King, from, ptype);
 
  139     while (! bitset.none()) 
 
  141       const Piece p = state.pieceOf(bitset.takeOneBit());
 
  144       const unsigned int i1 = indexPiece<true>(King, p.
square(), p.
ptype());
 
  145       const unsigned int index = composeIndex(index_king, i0, i1);
 
  151     const unsigned int i0 = indexPiece<false>(King, from, ptype);
 
  152     while (! bitset.none()) 
 
  154       const Piece p = state.pieceOf(bitset.takeOneBit());
 
  157       const unsigned int i1 = indexPiece<false>(King, p.
square(), p.
ptype());
 
  158       const unsigned int index = composeIndex(index_king, i0, i1);
 
  162   return (King == 
BLACK) ? sum : -sum;
 
  164 template <osl::Player King>
 
  168   const Square king = state.kingSquare(King);
 
  170   const int index_king = indexKing(King, king, flipx);
 
  173   PieceMask bitset = state.piecesOnBoard(King) & ~state.promotedPieces();
 
  174   bitset.clearBit<
KING>();
 
  175   FixedCapacityVector<Piece,38> pieces;
 
  178     i0 = indexPiece<true>(King, to, ptype);
 
  179     s0 = indexPiece<true>(King, from, ptype);
 
  180     while (! bitset.none()) 
 
  182       const Piece p = state.pieceOf(bitset.takeOneBit());
 
  185       const unsigned int i1 = indexPiece<true>(King, p.
square(), p.
ptype());
 
  186       const unsigned int index = composeIndex(index_king, i0, i1);
 
  188       const unsigned int sub_index = composeIndex(index_king, s0, i1);
 
  189       sum -= table[sub_index];
 
  194     i0 = indexPiece<false>(King, to, ptype);
 
  195     s0 = indexPiece<false>(King, from, ptype);
 
  196     while (! bitset.none()) 
 
  198       const Piece p = state.pieceOf(bitset.takeOneBit());
 
  201       const unsigned int i1 = indexPiece<false>(King, p.
square(), p.
ptype());
 
  202       const unsigned int index = composeIndex(index_king, i0, i1);
 
  204       const unsigned int sub_index = composeIndex(index_king, s0, i1);
 
  205       sum -= table[sub_index];
 
  208   sum -= table[composeIndex(index_king, i0, i0)];
 
  209   sum += table[composeIndex(index_king, s0, i0)];
 
  210   return (King == 
BLACK) ? sum : -sum;
 
  213 template <osl::Player P>
 
  217   assert(P == moved.
player());
 
  228     adjust_capture = roking.
y() >= 7;
 
  232     last_value[P] = evalOne<P>(state);
 
  234       last_value[
alt(P)] += sub<Opponent>(state, moved.
to(), 
captured);
 
  241       last_value[
alt(P)] += sub<Opponent>(state, moved.
to(), 
captured);
 
  248       last_value[P] += add<P>(state, moved.
to(), moved.
ptype());
 
  253     last_value[
alt(P)] += sub<Opponent>(state, moved.
to(), 
captured);
 
  260       last_value[P] += add<P>(state, moved.
to(), moved.
ptype());
 
  264     last_value[P] += sub<P>(state, moved.
from(), moved.
oldPtype());
 
  266     last_value[P] += addSub<P>(state, moved.
to(), moved.
ptype(), moved.
from());
 
  275       template void PiecePairKing::evalWithUpdateBang<BLACK>(
const NumEffectState&, 
Move, CArray<int,2>&);
 
  276       template void PiecePairKing::evalWithUpdateBang<WHITE>(
const NumEffectState&, 
Move, CArray<int,2>&);