kreversigame.h 1.17 KB
Newer Older
1 2 3 4 5
#ifndef KREVERSI_GAME_H
#define KREVERSI_GAME_H

#include <QObject>

6
#include "kreversiboard.h"
7 8 9 10 11 12 13 14 15 16

/**
 *  KReversiGame incapsulates all of the game logic.
 *  It creates KReversiBoard and manages a chips on it.
 *  Whenever the board state changes it emits corresponding signals.
 *  FIXME dimsuz: enumerate them briefly
 *  The idea is also to abstract from any graphic representation of the game process
 */
class KReversiGame : public QObject
{
17
    Q_OBJECT
18
public:
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
19
    KReversiGame();
20 21 22 23 24
    ~KReversiGame();
    /**
     *  @returns the board so the callers can examine its current state
     */
    const KReversiBoard& board() const;
25 26 27
    ChipColor currentPlayer() const { return NoColor;/* FIXME dimsuz: implement */ }
    int playerScore( ChipColor player ) const { return m_board->playerScore( player ); }
    ChipColor chipColorAt( int row, int col ) const { return m_board->chipColorAt( row, col ); }
28 29 30
    void putChipAt(int row, int col);
signals:
    void boardChanged();
31 32
private:
    KReversiBoard *m_board;
33 34 35 36 37 38 39 40
    /**
     *  Color of the current player
     */
    ChipColor m_curPlayer;
    /**
     *  The color of the computer played chips
     */
    ChipColor m_computerColor;
41 42
};
#endif