sennichite.cc Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sennichite.cc
Go to the documentation of this file.
1 /* sennichite.cc
2 */
3 #include "osl/sennichite.h"
4 #include <stdexcept>
5 #include <iostream>
6
7 osl::Player osl::Sennichite::winner() const
8 {
9 if (value == Result::BLACK_LOSE)
10 return WHITE;
11 else if (value == Result::WHITE_LOSE)
12 return BLACK;
13 throw std::runtime_error("no winner");
14 }
15
16 std::ostream& osl::operator<<(std::ostream& os, const Sennichite& s)
17 {
18 if (s.isNormal())
19 os << "sennichite normal";
20 else if (s.isDraw())
21 os << "sennichite draw";
22 else
23 os << "sennichite " << s.winner() << " win";
24 return os;
25 }
26
27 /* ------------------------------------------------------------------------- */
28 // ;;; Local Variables:
29 // ;;; mode:c++
30 // ;;; c-basic-offset:2
31 // ;;; End: