Debian Codegraph @

src/computerplayer.h

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2004-2007 Artur Wiebe *
3 * [email protected] *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21 #ifndef _COMPUTERPLAYER_H_
22 #define _COMPUTERPLAYER_H_
23
24
25 #include <QThread>
26
27 #include "player.h"
28
29
30 class myThread;
31
32
33 class myComputerPlayer : public myPlayer
34 {
35 Q_OBJECT
36
37 public:
38 myComputerPlayer(const QString& name, bool white, int skill);
39 ~myComputerPlayer();
40
41 virtual void yourTurn(const Checkers* game);
42 virtual void stop();
43
44 // need this to process thread's events
45 virtual void customEvent(QEvent*);
46
47 private:
48 myThread* m_thread;
49 Checkers* m_game;
50 int m_skill;
51 };
52
53
54
55 /****************************************************************************/
56 class myThread : public QThread {
57 public:
58 myThread(myComputerPlayer* p, Checkers* g)
59 : m_player(p), m_game(g), m_aborted(false) {}
60
61 virtual void run();
62
63 void stop();
64
65 Checkers* game() const { return m_game; }
66
67 private:
68 myComputerPlayer* m_player;
69 Checkers* m_game;
70 bool m_aborted;
71 };
72
73
74 #endif