00001 /* piecePairWithStand.tcc 00002 */ 00003 #ifndef EVAL_PPAIR_PIECEPAIRWITHSTAND_TCC 00004 #define EVAL_PPAIR_PIECEPAIRWITHSTAND_TCC 00005 00006 #include "osl/eval/ppair/piecePairWithStand.h" 00007 #include "osl/container/pieceValues.h" 00008 00009 template <class Table> 00010 void osl::eval::ppair::PiecePairWithStand<Table>:: 00011 setValues(const SimpleState& state, container::PieceValues& values) 00012 { 00013 base_t::setValues(state, values); 00014 // ®٤̵ 00015 for (int i=0; i<Piece::SIZE; i++) 00016 { 00017 const Piece piece = state.getPieceOf(i); 00018 if (piece.isOnBoard()) 00019 continue; 00020 values[i] += Ptype_Eval_Table.value(piece.ptypeO()); 00021 assert(isBasic(piece.ptype())); 00022 if (isMajorBasic(piece.ptype())) 00023 { 00024 values[i] += Ptype_Eval_Table.value(newPtypeO(piece.owner(), PAWN)); 00025 } 00026 } 00027 } 00028 00029 template <class Table> 00030 int osl::eval::ppair::PiecePairWithStand<Table>:: 00031 standBonus(const SimpleState& state) 00032 { 00033 int result = 0; 00034 for (int i=0; i<Piece::SIZE; i++) 00035 { 00036 const Piece piece = state.getPieceOf(i); 00037 if (piece.isOnBoard()) 00038 continue; 00039 result += standBonus(piece.ptypeO()); 00040 } 00041 return result; 00042 } 00043 00044 template <class Table> 00045 osl::eval::ppair::PiecePairWithStand<Table>:: 00046 PiecePairWithStand(const SimpleState& state) 00047 : base_t(state) 00048 { 00049 for (int i=0; i<Piece::SIZE; i++) 00050 { 00051 const Piece piece = state.getPieceOf(i); 00052 if (piece.isOnBoard()) 00053 continue; 00054 base_t::val += Ptype_Eval_Table.value(piece.ptypeO()); 00055 } 00056 base_t::val += standBonus(state); 00057 } 00058 00059 #endif /* EVAL_PPAIR_PIECEPAIRWITHSTAND_TCC */ 00060 // ;;; Local Variables: 00061 // ;;; mode:c++ 00062 // ;;; c-basic-offset:2 00063 // ;;; End: