1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:37:44 +00:00

Flood: Store the board as a vector of integers

This commit is contained in:
implicitfield 2022-11-28 22:12:12 +02:00 committed by Andreas Kling
parent 39caaae90a
commit aa24caffc5
4 changed files with 42 additions and 44 deletions

View file

@ -22,21 +22,21 @@ public:
size_t rows() const { return m_rows; }
bool is_flooded() const;
void set_cell(size_t row, size_t column, Color color);
Color cell(size_t row, size_t column) const;
void set_cell(size_t row, size_t column, int value);
int cell(size_t row, size_t column) const;
auto const& cells() const { return m_cells; }
void clear();
void randomize();
void reset();
void resize(size_t rows, size_t columns);
u32 update_colors(bool only_calculate_flooded_area = false);
u32 update_values(bool only_calculate_flooded_area = false);
Color get_current_color() { return m_current_color; }
Color get_previous_color() { return m_previous_color; }
int get_current_value() { return m_current_value; }
int get_previous_value() { return m_previous_value; }
Vector<Color> get_color_scheme() { return m_colors; }
void set_current_color(Color new_color);
void set_current_value(int new_value);
void set_color_scheme(Vector<Color> colors);
struct RowAndColumn {
@ -48,9 +48,9 @@ private:
size_t m_rows { 0 };
size_t m_columns { 0 };
Color m_current_color;
Color m_previous_color;
int m_current_value;
int m_previous_value;
Vector<Color> m_colors;
Vector<Vector<Color>> m_cells;
Vector<Vector<int>> m_cells;
};