piecePairWithStand.tcc Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
piecePairWithStand.tcc
Go to the documentation of this file.
1 /* piecePairWithStand.tcc
2 */
3 #ifndef EVAL_PPAIR_PIECEPAIRWITHSTAND_TCC
4 #define EVAL_PPAIR_PIECEPAIRWITHSTAND_TCC
5
6 #include "osl/eval/ppair/piecePairWithStand.h"
7 #include "osl/container/pieceValues.h"
8
9 template <class Table>
10 void osl::eval::ppair::PiecePairWithStand<Table>::
11 setValues(const SimpleState& state, container::PieceValues& values)
12 {
13 base_t::setValues(state, values);
14 // 速度は無視
15 for (int i=0; i<Piece::SIZE; i++)
16 {
17 const Piece piece = state.pieceOf(i);
18 values[i] += Table::Piece_Value.value(piece.ptypeO());
19 if (piece.isOnBoard())
20 continue;
21 assert(isBasic(piece.ptype()));
22 if (isMajorBasic(piece.ptype()))
23 {
24 values[i] += Table::Piece_Value.value(newPtypeO(piece.owner(), PAWN));
25 }
26 }
27 }
28
29 template <class Table>
30 int osl::eval::ppair::PiecePairWithStand<Table>::
31 standBonus(const SimpleState& state)
32 {
33 int result = 0;
34 for (int i=0; i<Piece::SIZE; i++)
35 {
36 const Piece piece = state.pieceOf(i);
37 if (piece.isOnBoard())
38 continue;
39 result += standBonus(piece.ptypeO());
40 }
41 return result;
42 }
43
44 template <class Table>
45 osl::eval::ppair::PiecePairWithStand<Table>::
46 PiecePairWithStand(const SimpleState& state)
47 : base_t(state)
48 {
49 for (int i=0; i<Piece::SIZE; i++)
50 {
51 const Piece piece = state.pieceOf(i);
52 base_t::val += Table::Piece_Value.value(piece.ptypeO());
53 }
54 base_t::val += standBonus(state);
55 }
56
57 #endif /* EVAL_PPAIR_PIECEPAIRWITHSTAND_TCC */
58 // ;;; Local Variables:
59 // ;;; mode:c++
60 // ;;; c-basic-offset:2
61 // ;;; End: