sennichite.h
Go to the documentation of this file.
/* sennichite.h
*/
#ifndef OSL_SENNICHITE_H
#define OSL_SENNICHITE_H
#include "osl/basic_type.h"
#include <iosfwd>
namespace osl
{
class Sennichite
{
friend bool operator==(const Sennichite&, const Sennichite&);
struct Result
{
enum Values { NORMAL, DRAW, BLACK_LOSE, WHITE_LOSE };
};
Result::Values value;
Sennichite(Result::Values v) : value(v) {}
public:
static Sennichite NORMAL() { return Result::NORMAL; }
static Sennichite DRAW() { return Result::DRAW; }
static Sennichite BLACK_LOSE() { return Result::BLACK_LOSE; }
static Sennichite WHITE_LOSE() { return Result::WHITE_LOSE; }
bool isNormal() const { return value == Result::NORMAL; }
bool isDraw() const { return value == Result::DRAW; }
bool hasWinner() const
{
return (value == Result::BLACK_LOSE) || (value == Result::WHITE_LOSE);
}
Player winner() const;
};
inline bool operator==(const Sennichite& l, const Sennichite& r)
{
return l.value == r.value;
}
std::ostream& operator<<(std::ostream&, const Sennichite&);
} // namespace osl
#endif /* OSL_SENNICHITE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::Sennichite
Definition sennichite.h:12
osl::Sennichite::DRAW
static Sennichite DRAW()
Definition sennichite.h:22
osl::Sennichite::hasWinner
bool hasWinner() const
Definition sennichite.h:28
osl::Sennichite::Sennichite
Sennichite(Result::Values v)
Definition sennichite.h:19
osl::Sennichite::BLACK_LOSE
static Sennichite BLACK_LOSE()
Definition sennichite.h:23
osl::Sennichite::WHITE_LOSE
static Sennichite WHITE_LOSE()
Definition sennichite.h:24
osl::Sennichite::winner
Player winner() const
Definition sennichite.cc:7
osl::Sennichite::isDraw
bool isDraw() const
Definition sennichite.h:27
osl::Sennichite::operator==
friend bool operator==(const Sennichite &, const Sennichite &)
Definition sennichite.h:35
osl::Sennichite::NORMAL
static Sennichite NORMAL()
Definition sennichite.h:21
osl::Sennichite::value
Result::Values value
Definition sennichite.h:18
osl::Sennichite::isNormal
bool isNormal() const
Definition sennichite.h:26
osl
Definition additionalEffect.h:6
osl::Player
Player
Definition basic_type.h:8
osl::operator<<
std::ostream & operator<<(std::ostream &os, Player player)
Definition basic_type.cc:14
osl::operator==
bool operator==(Square l, Square r)
Definition basic_type.h:758
osl::Sennichite::Result
Definition sennichite.h:15
osl::Sennichite::Result::Values
Values
Definition sennichite.h:16
osl::Sennichite::Result::DRAW
@ DRAW
Definition sennichite.h:16
osl::Sennichite::Result::WHITE_LOSE
@ WHITE_LOSE
Definition sennichite.h:16
osl::Sennichite::Result::NORMAL
@ NORMAL
Definition sennichite.h:16
osl::Sennichite::Result::BLACK_LOSE
@ BLACK_LOSE
Definition sennichite.h:16