Debian Codegraph @

src/game_tree/tree.h

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #ifndef TREE_H
24 #define TREE_H
25
26 #include "defines.h"
27
28 #include <QtCore>
29
30 class Move;
31 class Group;
32 class Matrix;
33 class GameResult;
34 class GameData;
35
36 class Tree : public QObject
37 {
38 Q_OBJECT
39 public:
40 Tree(int board_size, float komi);
41 ~Tree();
42 void init();
43 Move* getCurrent() const { return current; }
44 void setCurrent(Move *m);
45 Move* getRoot() const { return root; }
46 Move * findMoveInMainBranch(int x, int y) { return findMove(root, x, y, false); }
47 Move * findMoveInCurrentBranch(int x, int y) { return findMove(root, x, y, true); }
48 Move * findLastMoveInMainBranch();
49 Move * findLastMoveInCurrentBranch();
50 Move * findNode(Move *m, int node);
51 /*
52 * Former Boardhandler functions called by SGF parser
53 */
54
55 void addEmptyMove();
56 void doPass(bool sgf, bool fastLoad = false);
57
58 void deleteNode();
59
60 /*
61 * Former Stonehandler functions called by addStoneSGF
62 * Those functions are used when adding a stone, and check all Go issues : libertes, death, ...
63 */
64 void setLoadingSGF(bool b) { loadingSGF = b; }
65
66 void findMoveByPos(int x,int y);
67
68 // Do these functiones belong here? FIXME
69 void countScore();
70 void countMarked(Move * mv);
71 class GameResult retrieveScore(void);
72 void exitScore();
73
74 // Import SGF (from file or string)
75 // FIXME: read handicap from SGF
76 bool importSGFFile(QString filename);
77 bool importSGFString(QString SGF);
78 QString exportSGFString(GameData * gameData);
79
80 void slotNavBackward();
81 void slotNavForward();
82 void slotNavFirst();
83 void slotNavLast();
84 void slotNavPrevComment();
85 void slotNavNextComment();
86 void slotNavPrevVar();
87 void slotNavNextVar();
88 void slotNavStartVar();
89 void slotNavMainBranch();
90 void slotNavNextBranch();
91 void slotNthMove(int n);
92
93 signals:
94 void currentMoveChanged(Move*);
95 void scoreChanged(int,int,int,int,int,int);
96
97 protected:
98 Move* findMove(Move *start, int x, int y, bool checkmarker);
99
100 public:
101 Move *lastMoveInMainBranch;
102
103 private:
104 const int boardSize;
105
106 Move *root, *current;
107
108 bool loadingSGF;
109 int deadWhite, deadBlack;
110 int terrWhite, terrBlack;
111 int capturesBlack, capturesWhite;
112 float komi;
113 };
114
115 #endif