diff options
author | scratko <m@scratko.xyz> | 2024-11-16 14:59:17 +0300 |
---|---|---|
committer | scratko <m@scratko.xyz> | 2024-11-16 21:26:41 +0300 |
commit | 22d4fdabf17aebebfcb73c7d86b5bbc81b6530f4 (patch) | |
tree | 8c86594705005c380560e87b68b01993fc1928ef /menu_callbacks.cpp | |
parent | 060fe2ebc6f5ed26c445f95b3cd6c9ee5bc24e28 (diff) | |
download | picture-puzzle-22d4fdabf17aebebfcb73c7d86b5bbc81b6530f4.tar.gz picture-puzzle-22d4fdabf17aebebfcb73c7d86b5bbc81b6530f4.tar.bz2 picture-puzzle-22d4fdabf17aebebfcb73c7d86b5bbc81b6530f4.zip |
Added A* solution algorithm
Diffstat (limited to 'menu_callbacks.cpp')
-rw-r--r-- | menu_callbacks.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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 <FL/Fl_Native_File_Chooser.H> +#include <memory> #include <stdio.h> #include <string> #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<ASearch> algorithm = + ASearch::Start(reinterpret_cast<GameParams*>(gp)); + Node *goal = algorithm->FindSolution(); + algorithm->ShowSolution(goal); } -void about_callback(Fl_Widget *w, void *params) +void about_callback(Fl_Widget *w, void*) { } |