My Project
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
8{
10 return WHITE;
11 else if (value == Result::WHITE_LOSE)
12 return BLACK;
13 throw std::runtime_error("no winner");
14}
15
16std::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:
Player winner() const
Definition sennichite.cc:7
bool isDraw() const
Definition sennichite.h:27
Result::Values value
Definition sennichite.h:18
bool isNormal() const
Definition sennichite.h:26
Player
Definition basic_type.h:8
@ WHITE
Definition basic_type.h:10
@ BLACK
Definition basic_type.h:9
std::ostream & operator<<(std::ostream &os, Player player)
Definition basic_type.cc:14