Debian Codegraph @

src/game_tree/move.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 MOVE_H
24 #define MOVE_H
25
26 #include "defines.h"
27
28 #include <QtCore>
29
30 class Matrix;
31
32 class Move
33 {
34 public:
35 Move(int board_size);
36 Move(StoneColor c, int mx, int my, int n, GamePhase phase, const Matrix &mat, bool clearAllMarks=false, const QString &s=NULL);
37 Move(StoneColor c, int mx, int my, int n, GamePhase phase, const QString &s=NULL);
38 Move(Move *_parent, StoneColor _c, int _x, int _y);
39 ~Move();
40
41 int getX() const { return x; }
42 int getY() const { return y; }
43 void setX(int n) { x = n; }
44 void setY(int n) { y = n; }
45 StoneColor getColor() const { return stoneColor; }
46 void setColor(StoneColor c) { stoneColor = c; }
47 int getCapturesBlack() const { return capturesBlack; }
48 int getCapturesWhite() const { return capturesWhite; }
49 Matrix* getMatrix() { return matrix; }
50 void setMoveNumber(int n) { moveNum = n; }
51 int getMoveNumber() const { return moveNum; }
52 Move * getLastMove(bool followMarker = false);
53 GamePhase getGamePhase() const { return gamePhase; }
54 void setGamePhase(GamePhase p) { gamePhase = p; }
55 QString &getNodeName() { return nodeName; }
56 void setNodeName(const QString &s) { nodeName = s; }
57 QString &getComment() { return comment; }
58 void setComment(const QString &s) {
59 comment = s;
60 comment.squeeze();
61 }
62 QString &getUnknownProperty() { return unknownProperty; }
63 void setUnknownProperty(const QString &s) { unknownProperty = s; }
64 const QString saveMove(bool isRoot);
65 bool isTerritoryMarked() const { return terrMarked; }
66 void setTerritoryMarked(bool b=true) { terrMarked = b; }
67 //void insertFastLoadMark(int x, int y, MarkType markType, const QString &txt=0);
68 bool isScored() const { return scored; }
69 void setScore(float b, float w) { scored = true; scoreBlack = b; scoreWhite = w; }
70 void setScored(bool b=true) { scored = b; }
71 float getScoreBlack() const { return scoreBlack; }
72 float getScoreWhite() const { return scoreWhite; }
73 void setOpenMoves(int mv) { openMoves = mv; }
74 int getOpenMoves() { return openMoves; }
75 void setTimeLeft(float time) { timeLeft = time; }
76 float getTimeLeft() { return timeLeft; }
77 void setTimeinfo(bool ti) { timeinfo = ti; }
78 bool getTimeinfo() { return timeinfo; }
79 // PL[] info: show if stone color keeps equal
80 void clearPLinfo() { PLinfo = false; }
81 void setPLinfo(StoneColor sc) { PLinfo = true; PLnextMove = sc; }
82 bool getPLinfo() { return PLinfo; }
83 StoneColor getPLnextMove() { return PLnextMove; }
84 void setHandicapMove(bool b) { handicapMove = b; }
85 bool isHandicapMove() {return handicapMove ;}
86 void setNodeIndex(int i) {nodeIndex = i;}
87 int getNodeIndex() {return nodeIndex;}
88 void addBrother(Move * b);
89 void addStone(StoneColor c, int x, int y);
90
91 Move *brother, *son, *parent, *marker;
92 bool checked;
93 //QMap<int,FastLoadMark> *fastLoadMarkDict;
94 bool isPassMove();
95
96 int getNumBrothers();
97 int getNumSons();
98 bool hasParent();
99 bool hasPrevBrother();
100 bool hasNextBrother();
101 bool checkMoveIsValid(StoneColor c, int x, int y);
102 bool isInMainBranch() const;
103
104 Move *hasSon(StoneColor c, int x, int y);
105 Move *getPrevBrother();
106 Move *makeMove(StoneColor c, int x, int y, bool force = false);
107 Move *makePass();
108
109 StoneColor whoIsOnTurn();
110
111 private:
112 StoneColor stoneColor, PLnextMove;
113 int x, y, moveNum, capturesBlack, capturesWhite, openMoves , nodeIndex;
114 float scoreBlack, scoreWhite;
115 float timeLeft;
116 Matrix *matrix;
117 GamePhase gamePhase;
118 QString comment;
119 QString unknownProperty;
120 QString nodeName;
121 bool terrMarked, scored, timeinfo, PLinfo;
122 bool handicapMove;
123 };
124
125 #endif