File indexing completed on 2024-11-24 03:43:17

0001 /*******************************************************************
0002  *
0003  * Copyright 2007  Aron Boström <c02ab@efd.lth.se>
0004  *
0005  * Bovo is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2, or (at your option)
0008  * any later version.
0009  *
0010  * Bovo is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with Bovo; see the file COPYING.  If not, write to
0017  * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  *
0020  ********************************************************************/
0021 
0022 /**
0023  * @file ai.h declaring the Ai class
0024  */
0025 
0026 #ifndef BOVO_AI_H
0027 #define BOVO_AI_H
0028 
0029 #include <QObject>
0030 
0031 #include <KGameDifficulty>
0032 
0033 #include "common.h"
0034 
0035 using namespace bovo;
0036 
0037 /** namespace for game engine */
0038 namespace bovo
0039 {
0040 class Move;
0041 class Coord;
0042 class Dimension;
0043 } /* namespace bovo */
0044 
0045 /** namespace for AI stuff */
0046 namespace ai
0047 {
0048 
0049 /**
0050  * An AI player
0051  *
0052  * @code
0053  * Dimension dimension(width, height);
0054  * Ai* ai = aiFactory->createAi(dimension, easy, X, NotDemo);
0055  * Coord move = getMoveFromPlayerEitherByNetworkOrGui();
0056  * Coord aiMove = ai->move(move);
0057  * doSomethingWithAiMoveLikeDisplayingItInTheGui(aiMove);
0058  * @endcode
0059  */
0060 class Ai : public QObject
0061 {
0062     Q_OBJECT
0063 public:
0064     /**
0065      * @brief destructs this Ai
0066      * @description destructs this Ai object
0067      */
0068     ~Ai() override;
0069     virtual void cancelAndWait() = 0;
0070 
0071 public Q_SLOTS:
0072     virtual void changeBoard(const Move &move) = 0;
0073     virtual void gameOver() = 0;
0074     virtual void setSkill(KGameDifficultyLevel::StandardLevel skill) = 0;
0075     virtual void slotMove() = 0;
0076 };
0077 
0078 } /* namespace ai */
0079 
0080 #endif // BOVO_AI_H