Nonogram solver
Revisão | c8b492b56d3d160aaf1e241480a5064c27a61d9d (tree) |
---|---|
Hora | 2021-02-16 04:25:36 |
Autor | Alexander Larin <scalar438@gmai...> |
Commiter | Alexander Larin |
Another small changes
@@ -27,7 +27,7 @@ | ||
27 | 27 | { |
28 | 28 | // TODO: replace it to actual exception |
29 | 29 | if (max_colors > MAX_COLORS) throw 42; |
30 | - m_data = 1u >> (max_colors + 1) - 1u; | |
30 | + m_data = (1u << (max_colors + 1)) - 1u; | |
31 | 31 | } |
32 | 32 | |
33 | 33 | std::optional<int> Cell::get_color() const |
@@ -39,7 +39,7 @@ | ||
39 | 39 | |
40 | 40 | bool Cell::is_color_possible(int color_number) const |
41 | 41 | { |
42 | - return m_data & (1u << color_number) != 0; | |
42 | + return (m_data & (1u << color_number)) != 0; | |
43 | 43 | } |
44 | 44 | |
45 | 45 | bool Cell::is_impossible() const |
@@ -4,7 +4,8 @@ | ||
4 | 4 | std::vector<int> adjust(std::vector<Cell> &cells, std::vector<std::pair<int, int>> &block_list) |
5 | 5 | { |
6 | 6 | const size_t n = cells.size(); |
7 | - if (n == 0) return {}; | |
7 | + std::vector<int> res; | |
8 | + if (n == 0) return res; | |
8 | 9 | |
9 | 10 | const int max_colors = cells[0].max_colors(); |
10 | 11 | const size_t k = block_list.size(); |
@@ -51,4 +52,5 @@ | ||
51 | 52 | for (int i = 0; i <= max_colors; ++i) |
52 | 53 | {} |
53 | 54 | } |
55 | + return res; | |
54 | 56 | } |
\ No newline at end of file |