sennichite.cc
Go to the documentation of this file.
/* sennichite.cc
*/
#include "osl/sennichite.h"
#include <stdexcept>
#include <iostream>
osl::Player osl::Sennichite::winner() const
{
if (value == Result::BLACK_LOSE)
return WHITE;
else if (value == Result::WHITE_LOSE)
return BLACK;
throw std::runtime_error("no winner");
}
std::ostream& osl::operator<<(std::ostream& os, const Sennichite& s)
{
if (s.isNormal())
os << "sennichite normal";
else if (s.isDraw())
os << "sennichite draw";
else
os << "sennichite " << s.winner() << " win";
return os;
}
/* ------------------------------------------------------------------------- */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::Sennichite
Definition sennichite.h:12
osl::Sennichite::winner
Player winner() const
Definition sennichite.cc:7
osl::Sennichite::isDraw
bool isDraw() const
Definition sennichite.h:27
osl::Sennichite::value
Result::Values value
Definition sennichite.h:18
osl::Sennichite::isNormal
bool isNormal() const
Definition sennichite.h:26
osl::Player
Player
Definition basic_type.h:8
osl::WHITE
@ WHITE
Definition basic_type.h:10
osl::BLACK
@ BLACK
Definition basic_type.h:9
osl::operator<<
std::ostream & operator<<(std::ostream &os, Player player)
Definition basic_type.cc:14
sennichite.h
osl::Sennichite::Result::WHITE_LOSE
@ WHITE_LOSE
Definition sennichite.h:16
osl::Sennichite::Result::BLACK_LOSE
@ BLACK_LOSE
Definition sennichite.h:16