All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pieceValues.cc
Go to the documentation of this file.
1 // pieceValues.cc
4 #include <boost/foreach.hpp>
5 #include <iostream>
6 #include <iomanip>
7 
10 {
11 }
12 
15 {
16 }
17 
20 {
21  int result = 0;
22  BOOST_FOREACH(int v, *this)
23  {
24  result += v;
25  }
26  return result;
27 }
28 
29 #ifndef MINIMAL
31 PieceValues::showValues(std::ostream& os, const SimpleState& state) const
32 {
33  for (int y=1;y<=9;y++) {
34  os << y;
35  for (int x=9;x>0;x--) {
36  const Piece piece = state.pieceOnBoard(Square(x,y));
37  os << std::setw(7);
38  if (piece.isEmpty())
39  os << 0;
40  else
41  os << (*this)[piece.number()];
42  }
43  os << std::endl;
44  }
45  os << "black stand: ";
46  for (int i=0; i<Piece::SIZE; ++i)
47  {
48  const Piece piece = state.pieceOf(i);
49  if ((piece.owner() == BLACK)
50  && (piece.square().isPieceStand()))
51  os << piece.ptype() << " " << (*this)[piece.number()] << " ";
52  }
53  os << "\n";
54  os << "white stand: ";
55  for (int i=0; i<Piece::SIZE; ++i)
56  {
57  const Piece piece = state.pieceOf(i);
58  if ((piece.owner() == WHITE)
59  && (piece.square().isPieceStand()))
60  os << piece.ptype() << " " << (*this)[piece.number()] << " ";
61  }
62  os << "\n";
63  os << "total: " << sum() << "\n";
64 }
65 #endif
66 // ;;; Local Variables:
67 // ;;; mode:c++
68 // ;;; c-basic-offset:2
69 // ;;; End: