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 aigabor.h declaring the AiGabor class 0024 */ 0025 0026 #ifndef BOVO_AIGABOR_H 0027 #define BOVO_AIGABOR_H 0028 0029 #include <QFuture> 0030 0031 #include "../ai.h" 0032 #include "ai_interface.h" 0033 0034 /** namespace for AI stuff */ 0035 namespace ai 0036 { 0037 0038 /** 0039 * Gabor's implementation of the AI player 0040 */ 0041 class AiGabor : public Ai, public AiTimeOver 0042 { 0043 Q_OBJECT 0044 public: 0045 explicit AiGabor(const Dimension &dimension, KGameDifficultyLevel::StandardLevel skill, Player player); 0046 ~AiGabor() override; 0047 void cancelAndWait() override; 0048 bool isTimeOver() override; 0049 0050 public Q_SLOTS: 0051 void changeBoard(const Move &move) override; 0052 void gameOver() override; 0053 void setSkill(KGameDifficultyLevel::StandardLevel skill) override; 0054 void slotMove() override; 0055 0056 Q_SIGNALS: 0057 void move(const Move &move); 0058 0059 private: 0060 /* AI brain */ 0061 AiInterface *m_ai; 0062 0063 /* AI Player id */ 0064 const Player m_player; 0065 0066 /* minimum thinking time in milliseconds */ 0067 const int m_minThink; 0068 0069 /* for getting information about the thinking thread */ 0070 QFuture<void> m_future; 0071 0072 /* should the thinking thead try to cancel */ 0073 bool m_canceling; 0074 0075 void slotMoveImpl(); 0076 }; 0077 0078 } /* namespace ai */ 0079 0080 #endif // BOVO_AIGABOR_H