• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kigo

  • sources
  • kde-4.14
  • kdegames
  • kigo
  • src
  • game
player.h
Go to the documentation of this file.
1 /*
2  Copyright 2008 Sascha Peilicke <sasch.pe@gmx.de>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License as
6  published by the Free Software Foundation; either version 2 of
7  the License or (at your option) version 3 or any later version
8  accepted by the membership of KDE e.V. (or its successor approved
9  by the membership of KDE e.V.), which shall act as a proxy
10  defined in Section 14 of version 3 of the license.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef KIGO_PLAYER_H
22 #define KIGO_PLAYER_H
23 
24 #include <QString>
25 
26 namespace Kigo {
27 
36 class Player
37 {
38  friend class Game;
39 
40 public:
41  enum Color {
42  White = 1,
43  Black,
44  Invalid
45  };
46 
47  enum Type {
48  Human = 1,
49  Computer
50  };
51 
52 private:
53  explicit Player(Color color, Type type = Human);
54 
55 public:
56  Player(const Player &other);
57  Player &operator=(const Player &other);
58 
59  void setName(const QString &name) { m_name = name; }
60  QString name() const { return m_name; }
61 
62  bool setStrength(int strength);
63  int strength() const { return m_strength; }
64 
65  void setColor(Color color) { m_color = color; }
66  Color color() const { return m_color; }
67 
68  void setType(Type type) { m_type = type; }
69  Type type() const { return m_type; }
70 
71  bool isWhite() const { return m_color == White; }
72  bool isBlack() const { return m_color == Black; }
73  bool isValid() const { return m_color != Invalid; }
74  bool isHuman() const { return m_type == Human; }
75  bool isComputer() const { return m_type == Computer; }
76 
77  bool operator==(const Player &other) const;
78 
79 private:
80  QString m_name;
81  Color m_color;
82  Type m_type;
83  int m_strength;
84 };
85 
86 QDebug operator<<(QDebug debug, const Player &player);
87 
88 } // End of namespace Kigo
89 
90 #endif
Kigo::Player::isValid
bool isValid() const
Definition: player.h:73
Kigo::Player::operator=
Player & operator=(const Player &other)
Definition: player.cpp:38
Kigo::Player::type
Type type() const
Definition: player.h:69
Kigo::Player::color
Color color() const
Definition: player.h:66
Kigo::Player::Color
Color
Definition: player.h:41
Kigo::Player::setName
void setName(const QString &name)
Definition: player.h:59
Kigo::Player::strength
int strength() const
Definition: player.h:63
Kigo::Player::operator==
bool operator==(const Player &other) const
Definition: player.cpp:47
Kigo::Player::Type
Type
Definition: player.h:47
Kigo::Player::setStrength
bool setStrength(int strength)
Definition: player.cpp:55
Kigo::Player::setType
void setType(Type type)
Definition: player.h:68
Kigo::Player::setColor
void setColor(Color color)
Definition: player.h:65
Kigo::Player::Human
A human player.
Definition: player.h:48
QString
Kigo::Player
The Player class holds all basic attributes of a Go player.
Definition: player.h:36
QDebug
Kigo::Player::name
QString name() const
Definition: player.h:60
Kigo::Player::isHuman
bool isHuman() const
Definition: player.h:74
Kigo::Player::isComputer
bool isComputer() const
Definition: player.h:75
Kigo::Player::Black
The black player.
Definition: player.h:43
Kigo::Player::isBlack
bool isBlack() const
Definition: player.h:72
Kigo::Player::Invalid
Definition: player.h:44
Kigo::operator<<
QDebug operator<<(QDebug debug, const Move &move)
Definition: move.cpp:44
Kigo::Game
The Game class implements the Go game and acts as a wrapper around a remote Go Game game implementing...
Definition: game.h:60
Kigo::Player::White
The white player.
Definition: player.h:42
Kigo::Player::isWhite
bool isWhite() const
Definition: player.h:71
Kigo::Player::Computer
A computer player.
Definition: player.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:29 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kigo

Skip menu "kigo"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal