~ubuntu-branches/ubuntu/raring/qgo/raring

« back to all changes in this revision

Viewing changes to src/tree.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2005-01-01 23:07:10 UTC
  • Revision ID: james.westby@ubuntu.com-20050101230710-fhng6yidm47xlb2i
Tags: upstream-1.0.0-r2
ImportĀ upstreamĀ versionĀ 1.0.0-r2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* tree.h
 
3
*/
 
4
 
 
5
#ifndef TREE_H
 
6
#define TREE_H
 
7
 
 
8
#include <qptrstack.h>
 
9
class Move;
 
10
 
 
11
template<class type> class QPtrStack;
 
12
 
 
13
class Tree
 
14
{
 
15
public:
 
16
        Tree(int board_size);
 
17
        ~Tree();
 
18
        void init(int board_size);
 
19
        bool addBrother(Move *node);
 
20
        bool addSon(Move *node);
 
21
        int getNumBrothers();
 
22
        int getNumSons(Move *m=0);
 
23
        int getBranchLength(Move *node=0);
 
24
        Move* nextMove();
 
25
        Move* previousMove();
 
26
        Move* nextVariation();
 
27
        Move* previousVariation();
 
28
        bool hasSon(Move *m);
 
29
        bool hasPrevBrother(Move *m=0);
 
30
        bool hasNextBrother();
 
31
        void clear();
 
32
        static void traverseClear(Move *m);
 
33
        int count();
 
34
        Move* getCurrent() const { return current; }
 
35
        void setCurrent(Move *m) { current = m; }
 
36
        void setToFirstMove();
 
37
        Move* getRoot() const { return root; }
 
38
        void setRoot(Move *m) { root = m; }
 
39
        int mainBranchSize();
 
40
        Move* findMoveInMainBranch(int x, int y) { return findMove(root, x, y, false); }
 
41
        Move* findMoveInBranch(int x, int y) { return findMove(current, x, y, true); }
 
42
        Move* findLastMoveInMainBranch();   //SL added eb 9
 
43
        void traverseFind(Move *m, int x, int y, QPtrStack<Move> &result);
 
44
        
 
45
protected:
 
46
        Move* findMove(Move *start, int x, int y, bool checkmarker);
 
47
        
 
48
private:
 
49
        Move *root, *current;
 
50
};
 
51
 
 
52
#endif