kingPieceValues.h
Go to the documentation of this file.
00001 #ifndef ENDGAME_KINGPIECEVALUES_H
00002 #define ENDGAME_KINGPIECEVALUES_H
00003 #include "osl/container/pieceValues.h"
00004 #include "osl/state/simpleState.h"
00005 
00006 namespace osl
00007 {
00008   namespace eval
00009   {
00010     namespace endgame
00011     {
00015       template <class Eval>
00016       struct KingPieceValues
00017       {
00021         static void setValues(const SimpleState&, PieceValues&);
00022       };
00023     } // namespace endgame
00024   } // namespace eval
00025 } // namespace osl
00026 
00027 template <class Eval>
00028 void osl::eval::endgame::
00029 KingPieceValues<Eval>::setValues(const SimpleState& state, PieceValues& values)
00030 {
00031   values.fill(0);
00032   // 速度は無視
00033   const Piece king_black = state.kingPiece(BLACK);
00034   const Piece king_white = state.kingPiece(WHITE);
00035   
00036   for (int i=0; i<Piece::SIZE; i++) {
00037     if(!state.usedMask().test(i)) continue;
00038     const Piece target = state.pieceOf(i);
00039     values[i] = (Eval::valueOf(king_black, target) 
00040                  + Eval::valueOf(king_white, target));
00041   }
00042 }
00043 
00044 #endif /* ENDGAME_KINGPIECEVALUES_H */
00045 // ;;; Local Variables:
00046 // ;;; mode:c++
00047 // ;;; c-basic-offset:2
00048 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines