aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/editor
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-02-28 10:38:56 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-02-28 10:38:56 +0100
commitff6b1980c93140db2143b5dcad27f5cdc946632b (patch)
tree708df05cc54c626293ac1349d15e5bfb5305b0cb /src/game_tab/editor
parent175ce5e10859e2831b0e49a4bf768a9217305d8f (diff)
Improve live engine analysis dialog
Diffstat (limited to 'src/game_tab/editor')
-rw-r--r--src/game_tab/editor/LiveEngineDialog.cpp35
-rw-r--r--src/game_tab/editor/LiveEngineDialog.hpp2
-rw-r--r--src/game_tab/editor/LiveEngineDialogFB.cpp35
-rw-r--r--src/game_tab/editor/LiveEngineDialogFB.h9
4 files changed, 71 insertions, 10 deletions
diff --git a/src/game_tab/editor/LiveEngineDialog.cpp b/src/game_tab/editor/LiveEngineDialog.cpp
index 0fc85b0..4f745b4 100644
--- a/src/game_tab/editor/LiveEngineDialog.cpp
+++ b/src/game_tab/editor/LiveEngineDialog.cpp
@@ -31,6 +31,11 @@ void LiveEngineDialog::InitEngine() {
wxString default_value_wxString = conf->Read(optPath + "value");
std::string default_value = default_value_wxString.ToStdString();
engine->setoption(opt_name.ToStdString(), default_value);
+ if (opt_name.Lower() == "multipv") {
+ multipv->SetLabel(default_value_wxString);
+ } else if (opt_name.Lower() == "threads") {
+ threads->SetLabel(default_value_wxString);
+ }
} while (conf->GetNextGroup(opt_name, index));
}
@@ -52,20 +57,36 @@ void LiveEngineDialog::OnClose(wxCloseEvent &e) {
}
void LiveEngineDialog::SetFEN(std::string fen) {
- timer.Stop();
+ StopEngine();
engine->position(fen);
- uciadapter::Go args;
- engine->go(args);
- timer.Start(interval);
+ StartEngine();
}
void LiveEngineDialog::TogglePauseEngine(wxCommandEvent &event) {
if (timer.IsRunning()) {
- timer.Stop();
- engine_pause_button->SetLabel("Continue");
+ StopEngine();
+ engine_stop_button->SetLabel("Restart");
+ depth->Enable(true);
} else {
+ engine_stop_button->SetLabel("Stop");
+ depth->Enable(false);
+ StartEngine();
+ }
+}
+
+void LiveEngineDialog::StopEngine() {
+ if (timer.IsRunning()) {
+ timer.Stop();
+ }
+ engine->stop();
+};
+
+void LiveEngineDialog::StartEngine() {
+ uciadapter::Go args;
+ args.depth = depth->GetValue();
+ engine->go(args);
+ if (!timer.IsRunning()) {
timer.Start(interval);
- engine_pause_button->SetLabel("Pause");
}
}
diff --git a/src/game_tab/editor/LiveEngineDialog.hpp b/src/game_tab/editor/LiveEngineDialog.hpp
index 703abf8..4772e59 100644
--- a/src/game_tab/editor/LiveEngineDialog.hpp
+++ b/src/game_tab/editor/LiveEngineDialog.hpp
@@ -15,5 +15,7 @@ public:
void TogglePauseEngine(wxCommandEvent &event);
void OnTimerTick(wxTimerEvent &event);
void SetFEN(std::string fen);
+ void StopEngine();
+ void StartEngine();
void OnClose(wxCloseEvent &e);
}; \ No newline at end of file
diff --git a/src/game_tab/editor/LiveEngineDialogFB.cpp b/src/game_tab/editor/LiveEngineDialogFB.cpp
index 11234dd..52624e3 100644
--- a/src/game_tab/editor/LiveEngineDialogFB.cpp
+++ b/src/game_tab/editor/LiveEngineDialogFB.cpp
@@ -30,12 +30,43 @@ LiveEngineDialogFB::LiveEngineDialogFB( wxWindow* parent, wxWindowID id, const w
current_engine_sizer->Add( 0, 0, 1, wxEXPAND, 5 );
- engine_pause_button = new wxButton( this, LIVE_ENGINE_PAUSE_BUTTON, wxT("Pause"), wxDefaultPosition, wxDefaultSize, 0 );
- current_engine_sizer->Add( engine_pause_button, 0, wxALL, 5 );
+ engine_stop_button = new wxButton( this, LIVE_ENGINE_PAUSE_BUTTON, wxT("Stop"), wxDefaultPosition, wxDefaultSize, 0 );
+ current_engine_sizer->Add( engine_stop_button, 0, wxALL, 5 );
main_sizer->Add( current_engine_sizer, 0, wxEXPAND, 5 );
+ wxGridSizer* infos_sizer;
+ infos_sizer = new wxGridSizer( 0, 6, 0, 0 );
+
+ multipv_label = new wxStaticText( this, wxID_ANY, wxT("MultiPV:"), wxDefaultPosition, wxDefaultSize, 0 );
+ multipv_label->Wrap( -1 );
+ infos_sizer->Add( multipv_label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ multipv = new wxStaticText( this, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, 0 );
+ multipv->Wrap( -1 );
+ infos_sizer->Add( multipv, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ threads_label = new wxStaticText( this, wxID_ANY, wxT("Threads:"), wxDefaultPosition, wxDefaultSize, 0 );
+ threads_label->Wrap( -1 );
+ infos_sizer->Add( threads_label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ threads = new wxStaticText( this, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, 0 );
+ threads->Wrap( -1 );
+ infos_sizer->Add( threads, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ m_staticText13 = new wxStaticText( this, wxID_ANY, wxT("Depth:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText13->Wrap( -1 );
+ infos_sizer->Add( m_staticText13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ depth = new wxSpinCtrl( this, wxID_ANY, wxT("30"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 10000, 0 );
+ depth->Enable( false );
+
+ infos_sizer->Add( depth, 0, wxALL, 5 );
+
+
+ main_sizer->Add( infos_sizer, 0, 0, 5 );
+
lines_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
main_sizer->Add( lines_list, 1, wxALL|wxEXPAND, 5 );
diff --git a/src/game_tab/editor/LiveEngineDialogFB.h b/src/game_tab/editor/LiveEngineDialogFB.h
index 8c9c061..29f0292 100644
--- a/src/game_tab/editor/LiveEngineDialogFB.h
+++ b/src/game_tab/editor/LiveEngineDialogFB.h
@@ -20,6 +20,7 @@
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/sizer.h>
+#include <wx/spinctrl.h>
#include <wx/listctrl.h>
#include <wx/dialog.h>
@@ -37,7 +38,13 @@ class LiveEngineDialogFB : public wxDialog
protected:
wxStaticText* current_engine_label;
wxStaticText* current_engine;
- wxButton* engine_pause_button;
+ wxButton* engine_stop_button;
+ wxStaticText* multipv_label;
+ wxStaticText* multipv;
+ wxStaticText* threads_label;
+ wxStaticText* threads;
+ wxStaticText* m_staticText13;
+ wxSpinCtrl* depth;
wxListCtrl* lines_list;
public: