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

0001 /*******************************************************************
0002  *
0003  * Copyright 2009  Pelladi Gabor <pelladigabor@gmail.com>
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 aifactory.h declaring the AiFactory class
0024  */
0025 
0026 #ifndef BOVO_AIFACTORY_H
0027 #define BOVO_AIFACTORY_H
0028 
0029 #include <QObject>
0030 #include <QString>
0031 #include <QStringList>
0032 
0033 #include <KGameDifficulty>
0034 
0035 #include "common.h"
0036 
0037 using namespace bovo;
0038 
0039 /** namespace for game engine */
0040 namespace bovo
0041 {
0042 class Dimension;
0043 } /* namespace bovo */
0044 
0045 /** namespace for AI stuff */
0046 namespace ai
0047 {
0048 
0049 class Ai;
0050 
0051 /**
0052  * Provider of AI implementations
0053  */
0054 class AiFactory : public QObject
0055 {
0056     Q_OBJECT
0057 public:
0058     /**
0059      * @brief constructs an AiFactory
0060      * @description constructs an AiFactory object
0061      */
0062     AiFactory();
0063 
0064     /**
0065      * @brief destructs this AiFactory
0066      * @description destructs this AiFactory object
0067      */
0068     ~AiFactory() override;
0069 
0070     /**
0071      * @brief Constructs an Ai with width, height, player and Skill
0072      * @description Constructs an AI player with a specified width, height and
0073      * skill as well as player id using the currently chosen implementation
0074      * @param dimension the dimension controlling width and height
0075      * @param skill the skill (difficulty level) the AI player will be playing with
0076      * @param player player id of this AI
0077      * @param demoMode indicates the current game mode
0078      */
0079     Ai *createAi(const Dimension &dimension, KGameDifficultyLevel::StandardLevel skill, Player player, DemoMode demoMode) const;
0080 
0081     /**
0082      * @brief returns the available AI-s
0083      * @description returns a list of the names of the available AI-s
0084      */
0085     const QStringList &aiList() const;
0086 
0087     /**
0088      * @brief returns the current AI
0089      * @description returns the index of the current AI as present in the list
0090      */
0091     int ai() const;
0092 
0093     /**
0094      * @brief change the AI
0095      * @description changes the current AI to the specified index in the AI list
0096      */
0097     void changeAi(int ai);
0098 
0099 private:
0100     QStringList m_aiList;
0101     int m_ai;
0102 };
0103 
0104 } /* namespace ai */
0105 
0106 #endif // BOVO_AIFACTORY_H