All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
piece.cc
Go to the documentation of this file.
1 #include "osl/piece.h"
2 #include "osl/ptypeTraits.h"
3 #include <boost/static_assert.hpp>
4 #include <iostream>
5 #include <stdexcept>
6 
7 namespace osl
8 {
9  BOOST_STATIC_ASSERT(sizeof(Piece) == 4);
10 } // namespace osl
11 
12 std::ostream& osl::operator<<(std::ostream& os,const Piece piece)
13 {
14  if (piece.isPiece())
15  os << "Piece(" << piece.owner() << "," << piece.ptype()
16  << ",num=" << piece.number()
17  << "," << piece.square() << ')';
18  else if (piece == Piece::EMPTY())
19  os << "PIECE_EMPTY";
20  else if (piece == Piece::EDGE())
21  os << "PIECE_EDGE";
22  else
23  os << "unkown piece?!";
24  return os;
25 }
26 
28 {
29  const int number = ((owner == BLACK)
32  return Piece(owner, KING, number, position);
33 }
34 
35 
36 // ;;; Local Variables:
37 // ;;; mode:c++
38 // ;;; c-basic-offset:2
39 // ;;; End: