All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kingPieceValues.h
Go to the documentation of this file.
1 #ifndef ENDGAME_KINGPIECEVALUES_H
2 #define ENDGAME_KINGPIECEVALUES_H
5 
6 namespace osl
7 {
8  namespace eval
9  {
10  namespace endgame
11  {
15  template <class Eval>
17  {
21  static void setValues(const SimpleState&, PieceValues&);
22  };
23  } // namespace endgame
24  } // namespace eval
25 } // namespace osl
26 
27 template <class Eval>
29 KingPieceValues<Eval>::setValues(const SimpleState& state, PieceValues& values)
30 {
31  values.fill(0);
32  // 速度は無視
33  const Piece king_black = state.kingPiece(BLACK);
34  const Piece king_white = state.kingPiece(WHITE);
35 
36  for (int i=0; i<Piece::SIZE; i++) {
37  if(!state.usedMask().test(i)) continue;
38  const Piece target = state.pieceOf(i);
39  values[i] = (Eval::valueOf(king_black, target)
40  + Eval::valueOf(king_white, target));
41  }
42 }
43 
44 #endif /* ENDGAME_KINGPIECEVALUES_H */
45 // ;;; Local Variables:
46 // ;;; mode:c++
47 // ;;; c-basic-offset:2
48 // ;;; End: