qtictactoegame.h 579 B

123456789101112131415161718192021222324252627282930
  1. #ifndef QTICTACTOEGAME_H
  2. #define QTICTACTOEGAME_H
  3. #include <QObject>
  4. class QTicTacToeGame : public QObject
  5. {
  6. Q_OBJECT
  7. public:
  8. explicit QTicTacToeGame(int size = 3, int countToWin = 3, QObject *parent = 0);
  9. bool put(int x, int y, int player);
  10. int getPlayer(int x, int y);
  11. Q_INVOKABLE int getSize();
  12. void clear();
  13. private:
  14. int **board;
  15. int size, countToWin, aviableCells;
  16. bool checkFromPoint(int x, int y);
  17. signals:
  18. void gameOver(int player);
  19. void itemPuted(int x, int y, int player);
  20. public slots:
  21. };
  22. #endif // QTICTACTOEGAME_H