From 7b06d3924cc17e8f99bd8d6453ff15b62da2e02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Leclaire-Fournier?= Date: Wed, 17 Jan 2024 19:32:35 -0500 Subject: [PATCH] Petits changements --- GPA675Lab1GOL/GOLTeamH.cpp | 16 ++++++++++------ GPA675Lab1GOL/GOLTeamH.h | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/GPA675Lab1GOL/GOLTeamH.cpp b/GPA675Lab1GOL/GOLTeamH.cpp index 888a4ee..4dc090f 100644 --- a/GPA675Lab1GOL/GOLTeamH.cpp +++ b/GPA675Lab1GOL/GOLTeamH.cpp @@ -2,27 +2,27 @@ size_t GOLTeamH::width() const { - return size_t(); + return mData.width(); } size_t GOLTeamH::height() const { - return size_t(); + return mData.height(); } size_t GOLTeamH::size() const { - return size_t(); + return mData.size(); } GOL::State GOLTeamH::state(int x, int y) const { - return State(); + return mData.value(x, y); } std::string GOLTeamH::rule() const { - return std::string(); + return mRule; } 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) { - return false; + mRule = rule; + return true; + // TODO: return false si parsing error; } void GOLTeamH::setBorderManagement(BorderManagement borderManagement) @@ -61,10 +63,12 @@ void GOLTeamH::setBorderManagement(BorderManagement borderManagement) void GOLTeamH::setState(int x, int y, State state) { + mData.setAt(x, y, state); } void GOLTeamH::fill(State state) { + mData.resize(mData.width(), mData.height(), state); } void GOLTeamH::fillAlternately(State firstCell) diff --git a/GPA675Lab1GOL/GOLTeamH.h b/GPA675Lab1GOL/GOLTeamH.h index cd4a39e..8fab3d1 100644 --- a/GPA675Lab1GOL/GOLTeamH.h +++ b/GPA675Lab1GOL/GOLTeamH.h @@ -16,6 +16,7 @@ public: Color color(State state) const override; Statistics statistics() const override; ImplementationInformation information() const override; + void resize(size_t width, size_t height, State defaultState) override; bool setRule(std::string const& rule) override; void setBorderManagement(BorderManagement borderManagement) override;