Cluedo Solver v1.0
Cluedo game solver making deductions.
Loading...
Searching...
No Matches
AddInformationModal.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4
5#include "../Solver.hpp"
6#include "ErrorModal.hpp"
7
10
11namespace Cluedo {
12
13namespace UI {
14
25public:
30 explicit AddInformationModal(std::function<void(std::string&&, Solver&&)> on_learn_callback)
31 : m_on_learn_callback(on_learn_callback) {}
32
35 void reset();
38 void show(Solver& solver);
39
40private:
41 void show_buttons(Solver&);
42
43 enum class Tab {
44 PlayerCardState,
45 Suggestion
46 };
47
48 class PlayerCardStateTab {
49 public:
50 void reset();
51 void show(Tab&, Solver&);
52
53 void learn(Solver&);
54 std::string compute_information_string(Solver const&);
55
56 private:
57 size_t m_player_index;
58 Card m_card;
59 bool m_card_state;
60 };
61
62 class SuggestionTab {
63 public:
64 void reset();
65 void show(Tab&, Solver&);
66
67 void learn(Solver&);
68 std::string compute_information_string(Solver const&);
69
70 private:
71 Solver::Suggestion m_suggestion;
72 };
73
74 Tab m_selected_tab;
75 PlayerCardStateTab m_player_card_state_tab;
76 SuggestionTab m_suggestion_tab;
77 std::function<void(std::string&&, Solver&&)> m_on_learn_callback;
78 ErrorModal m_error_modal;
79};
80
81}
82
83}
Card
All the cards in Cluedo.
Definition Card.hpp:66
The file that contains the definition of the Cluedo::UI::ErrorModal class.
The file that contains the definition of the Cluedo::Solver class.
The solver of a Cluedo game.
Definition Solver.hpp:24
void show(Solver &solver)
Definition AddInformationModal.cpp:241
void reset()
Definition AddInformationModal.cpp:235
AddInformationModal(std::function< void(std::string &&, Solver &&)> on_learn_callback)
Definition AddInformationModal.hpp:30