|
| 1 | +#include <array> |
1 | 2 | #include <functional> |
2 | 3 | #include <iostream> |
3 | 4 | #include <random> |
4 | | -#include <array> |
5 | 5 |
|
6 | 6 | #include <docopt/docopt.h> |
7 | 7 | #include <ftxui/component/captured_mouse.hpp>// for ftxui |
@@ -35,21 +35,19 @@ template<std::size_t Width, std::size_t Height> struct GameBoard |
35 | 35 | std::array<std::array<std::string, height>, width> strings; |
36 | 36 | std::array<std::array<bool, height>, width> values{}; |
37 | 37 |
|
38 | | - std::size_t move_count{0}; |
| 38 | + std::size_t move_count{ 0 }; |
39 | 39 |
|
40 | | - std::string &get_string(std::size_t x, std::size_t y) { |
41 | | - return strings.at(x).at(y); |
42 | | - } |
| 40 | + std::string &get_string(std::size_t x, std::size_t y) { return strings.at(x).at(y); } |
43 | 41 |
|
44 | 42 |
|
45 | 43 | void set(std::size_t x, std::size_t y, bool new_value) |
46 | 44 | { |
47 | | - get(x,y) = new_value; |
| 45 | + get(x, y) = new_value; |
48 | 46 |
|
49 | 47 | if (new_value) { |
50 | | - get_string(x,y) = " ON"; |
| 48 | + get_string(x, y) = " ON"; |
51 | 49 | } else { |
52 | | - get_string(x,y) = "OFF"; |
| 50 | + get_string(x, y) = "OFF"; |
53 | 51 | } |
54 | 52 | } |
55 | 53 |
|
@@ -126,7 +124,7 @@ int main(int argc, const char **argv) |
126 | 124 | std::vector<ftxui::Component> buttons; |
127 | 125 | for (std::size_t x = 0; x < gb.width; ++x) { |
128 | 126 | for (std::size_t y = 0; y < gb.height; ++y) { |
129 | | - buttons.push_back(ftxui::Button(&gb.get_string(x,y), [=, &gb] { |
| 127 | + buttons.push_back(ftxui::Button(&gb.get_string(x, y), [=, &gb] { |
130 | 128 | if (!gb.solved()) { gb.press(x, y); } |
131 | 129 | update_quit_text(gb); |
132 | 130 | })); |
@@ -162,7 +160,7 @@ int main(int argc, const char **argv) |
162 | 160 | static constexpr int randomization_iterations = 100; |
163 | 161 | static constexpr int random_seed = 42; |
164 | 162 |
|
165 | | - std::mt19937 gen32{random_seed}; // NOLINT |
| 163 | + std::mt19937 gen32{ random_seed };// NOLINT |
166 | 164 | std::uniform_int_distribution<std::size_t> x(static_cast<std::size_t>(0), gb.width - 1); |
167 | 165 | std::uniform_int_distribution<std::size_t> y(static_cast<std::size_t>(0), gb.height - 1); |
168 | 166 |
|
|
0 commit comments