File indexing completed on 2025-03-23 06:54:31
0001 /* 0002 SPDX-FileCopyrightText: 2008 Sascha Peilicke <sasch.pe@gmx.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef KIGO_SCORE_H 0008 #define KIGO_SCORE_H 0009 0010 #include <QObject> 0011 #include <QString> 0012 0013 namespace Kigo { 0014 0015 /** 0016 * This class represents a Go score for either player. A score can only 0017 * be created by a Kigo::Game instance. The score will always hold the 0018 * points of the leading player (together with certain probability bounds) 0019 * and can thus be only created by the Go engine (Kigo::Game). 0020 * 0021 * @author Sascha Peilicke <sasch.pe@gmx.de> 0022 * @since 0.5 0023 */ 0024 class Score : public QObject 0025 { 0026 Q_OBJECT 0027 0028 friend class Game; 0029 0030 private: 0031 explicit Score(const QString &score = QString()); 0032 0033 public: 0034 Score(const Score &other); 0035 Score &operator=(const Score &other); 0036 0037 bool isValid() const; 0038 QString toString() const; 0039 0040 QChar color() const { return m_color; } 0041 float score() const { return m_score; } 0042 float lowerBound() const { return m_lowerBound; } 0043 float upperBound() const { return m_upperBound; } 0044 0045 private: 0046 QChar m_color; ///< The color of the player which has more points 0047 float m_score; ///< The amount of points the player leads with 0048 float m_lowerBound; ///< Estimate lower bound 0049 float m_upperBound; ///< Estimate upper bound 0050 }; 0051 0052 } // End of namespace Kigo 0053 0054 #endif