Petits changements

This commit is contained in:
Timothée Leclaire-Fournier 2024-01-17 19:32:35 -05:00
parent f9a29201b0
commit 7b06d3924c
2 changed files with 11 additions and 6 deletions

View File

@ -2,27 +2,27 @@
size_t GOLTeamH::width() const size_t GOLTeamH::width() const
{ {
return size_t(); return mData.width();
} }
size_t GOLTeamH::height() const size_t GOLTeamH::height() const
{ {
return size_t(); return mData.height();
} }
size_t GOLTeamH::size() const size_t GOLTeamH::size() const
{ {
return size_t(); return mData.size();
} }
GOL::State GOLTeamH::state(int x, int y) const GOL::State GOLTeamH::state(int x, int y) const
{ {
return State(); return mData.value(x, y);
} }
std::string GOLTeamH::rule() const std::string GOLTeamH::rule() const
{ {
return std::string(); return mRule;
} }
GOL::BorderManagement GOLTeamH::borderManagement() const GOL::BorderManagement GOLTeamH::borderManagement() const
@ -52,7 +52,9 @@ void GOLTeamH::resize(size_t width, size_t height, State defaultState)
bool GOLTeamH::setRule(std::string const& rule) bool GOLTeamH::setRule(std::string const& rule)
{ {
return false; mRule = rule;
return true;
// TODO: return false si parsing error;
} }
void GOLTeamH::setBorderManagement(BorderManagement borderManagement) void GOLTeamH::setBorderManagement(BorderManagement borderManagement)
@ -61,10 +63,12 @@ void GOLTeamH::setBorderManagement(BorderManagement borderManagement)
void GOLTeamH::setState(int x, int y, State state) void GOLTeamH::setState(int x, int y, State state)
{ {
mData.setAt(x, y, state);
} }
void GOLTeamH::fill(State state) void GOLTeamH::fill(State state)
{ {
mData.resize(mData.width(), mData.height(), state);
} }
void GOLTeamH::fillAlternately(State firstCell) void GOLTeamH::fillAlternately(State firstCell)

View File

@ -16,6 +16,7 @@ public:
Color color(State state) const override; Color color(State state) const override;
Statistics statistics() const override; Statistics statistics() const override;
ImplementationInformation information() const override; ImplementationInformation information() const override;
void resize(size_t width, size_t height, State defaultState) override; void resize(size_t width, size_t height, State defaultState) override;
bool setRule(std::string const& rule) override; bool setRule(std::string const& rule) override;
void setBorderManagement(BorderManagement borderManagement) override; void setBorderManagement(BorderManagement borderManagement) override;