Fixed sideeffects of enabling the gui to visualize the search tree.
[rattatechess.git] / search_gui.h
blob6d17c78d9d0dcf8b0c1b94d02b10aff8e6ebbdcf
1 /***************************************************************************
2 search_gui.h - Gui to view the search tree
3 -------------------
4 begin : Sat Oct 06 2007
5 copyright : (C) 2007 by Maurizio Monge
6 email : monge@linuz.sns.it
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef __SEARCH_GUI_H__
19 #define __SEARCH_GUI_H__
21 #ifndef NO_GUI
23 #include "engine.h"
24 #include <QObject>
25 class QTreeWidget;
26 class QTreeWidgetItem;
27 class QApplication;
29 class SearchGui : public QObject
31 Q_OBJECT
32 QApplication *app;
33 QTreeWidget *tree_widget;
35 int max_ply;
37 public:
38 const static int Italic = 1<<0;
39 const static int Bold = 1<<1;
40 const static int NoItalic = 1<<2;
41 const static int NoBold = 1<<3;
42 const static int Gray = 1<<4;
43 const static int Red = 1<<5;
44 const static int Green = 1<<6;
45 const static int Blue = 1<<7;
46 const static int Magenta = 1<<8;
47 SearchGui(int& argc, char** argv);
48 ~SearchGui();
50 static void apply_flags(QTreeWidgetItem* w, int flags);
51 void init_root();
52 void new_root_level(int depth);
53 void notify(const Board *board, Move m, int ply, int depth, int heuval, int alpha, int beta, int flags);
54 void notify_value(int ply, int value, int nodecount, int newflags);
55 void notify_eval(int ply, int value, int alpha, int beta, int flags);
56 void notify_hash(int ply, int lower, int upper, int depth, int alpha, int beta, Move best, bool write, int flags);
57 void wait_input();
58 void process_events();
61 #define DIFF_NODES (engine->processed_nodes-__nc)
62 #define GUI1(a) {uint64_t __nc = engine->processed_nodes; if(search_gui) { search_gui->a; } else {}
63 #define GUI2(a) if(search_gui) { search_gui->a; } else {} }
64 #define GUI(a) if(search_gui) search_gui->a; else {}
65 #define IFGUI(a) a
67 // #define GUI1(a)
68 // #define GUI2(a)
70 #else
72 class SearchGui
74 public:
75 const static int Italic = 1<<0;
76 const static int Bold = 1<<1;
77 const static int NoItalic = 1<<2;
78 const static int NoBold = 1<<3;
79 const static int Gray = 1<<4;
80 const static int Red = 1<<5;
81 const static int Green = 1<<6;
82 const static int Blue = 1<<7;
83 const static int Magenta = 1<<8;
85 SearchGui(int& argc, char** argv){}
86 ~SearchGui(){}
88 void init_root(){}
89 void new_root_level(int depth){}
90 void notify(Board *board, Move m, int ply, int depth, int heuval, int alpha, int beta, int flags){}
91 void notify_value(int ply, int value, int nodecount, int newflags){}
92 void notify_eval(int ply, int value, int alpha, int beta, int flags){}
93 void notify_hash(int ply, int lower, int upper, int depth, int alpha, int beta, Move best, bool write, int flags){}
94 void wait_input(){}
95 void process_events(){}
98 #define GUI1(a)
99 #define GUI2(a)
100 #define GUI(a)
101 #define IFGUI(a)
103 #endif
105 #endif //__SEARCH_GUI_H__