From 22d4fdabf17aebebfcb73c7d86b5bbc81b6530f4 Mon Sep 17 00:00:00 2001 From: scratko Date: Sat, 16 Nov 2024 14:59:17 +0300 Subject: Added A* solution algorithm --- menu_callbacks.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'menu_callbacks.cpp') diff --git a/menu_callbacks.cpp b/menu_callbacks.cpp index df70514..d43d848 100644 --- a/menu_callbacks.cpp +++ b/menu_callbacks.cpp @@ -1,10 +1,12 @@ #include +#include #include #include #include "menu_callbacks.hpp" +#include "solution_algorithm.hpp" -void load_file_callback(Fl_Widget *sender, void *window) +void load_file_callback(Fl_Widget *sender, void*) { auto dialog = Fl_Native_File_Chooser{}; dialog.type(Fl_Native_File_Chooser::BROWSE_FILE); @@ -20,15 +22,19 @@ void load_file_callback(Fl_Widget *sender, void *window) printf("%s\n", dialog.filename()); } -void exit_callback(Fl_Widget *w, void *params) +void exit_callback(Fl_Widget *w, void*) { w->parent()->hide(); } -void solve_problem_callback(Fl_Widget *w, void *params) +void solve_problem_callback(Fl_Widget *w, void *gp) { + std::unique_ptr algorithm = + ASearch::Start(reinterpret_cast(gp)); + Node *goal = algorithm->FindSolution(); + algorithm->ShowSolution(goal); } -void about_callback(Fl_Widget *w, void *params) +void about_callback(Fl_Widget *w, void*) { } -- cgit v1.2.3