My Project
sennichite.h
Go to the documentation of this file.
1 /* sennichite.h
2  */
3 #ifndef OSL_SENNICHITE_H
4 #define OSL_SENNICHITE_H
5 
6 #include "osl/basic_type.h"
7 #include <iosfwd>
8 
9 namespace osl
10 {
11  class Sennichite
12  {
13  friend bool operator==(const Sennichite&, const Sennichite&);
14  struct Result
15  {
17  };
20  public:
21  static Sennichite NORMAL() { return Result::NORMAL; }
22  static Sennichite DRAW() { return Result::DRAW; }
25 
26  bool isNormal() const { return value == Result::NORMAL; }
27  bool isDraw() const { return value == Result::DRAW; }
28  bool hasWinner() const
29  {
30  return (value == Result::BLACK_LOSE) || (value == Result::WHITE_LOSE);
31  }
32  Player winner() const;
33  };
34 
35  inline bool operator==(const Sennichite& l, const Sennichite& r)
36  {
37  return l.value == r.value;
38  }
39  std::ostream& operator<<(std::ostream&, const Sennichite&);
40 } // namespace osl
41 
42 #endif /* OSL_SENNICHITE_H */
43 // ;;; Local Variables:
44 // ;;; mode:c++
45 // ;;; c-basic-offset:2
46 // ;;; End:
static Sennichite DRAW()
Definition: sennichite.h:22
bool hasWinner() const
Definition: sennichite.h:28
Sennichite(Result::Values v)
Definition: sennichite.h:19
static Sennichite BLACK_LOSE()
Definition: sennichite.h:23
friend bool operator==(const Sennichite &, const Sennichite &)
Definition: sennichite.h:35
static Sennichite WHITE_LOSE()
Definition: sennichite.h:24
Player winner() const
Definition: sennichite.cc:7
bool isDraw() const
Definition: sennichite.h:27
static Sennichite NORMAL()
Definition: sennichite.h:21
Result::Values value
Definition: sennichite.h:18
bool isNormal() const
Definition: sennichite.h:26
Player
Definition: basic_type.h:8
std::ostream & operator<<(std::ostream &os, Player player)
Definition: basic_type.cc:14
bool operator==(Square l, Square r)
Definition: basic_type.h:758