summaryrefslogtreecommitdiff
path: root/Homework/cs3460/gameoflife/LifeSimulator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Homework/cs3460/gameoflife/LifeSimulator.hpp')
-rw-r--r--Homework/cs3460/gameoflife/LifeSimulator.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/Homework/cs3460/gameoflife/LifeSimulator.hpp b/Homework/cs3460/gameoflife/LifeSimulator.hpp
new file mode 100644
index 0000000..38e086b
--- /dev/null
+++ b/Homework/cs3460/gameoflife/LifeSimulator.hpp
@@ -0,0 +1,35 @@
+#include "Pattern.hpp"
+
+#include <algorithm>
+#include <array>
+#include <cstdint>
+#include <memory>
+#include <omp.h>
+#include <vector>
+
+#ifndef LIFESIMULATOR_HPP
+ #define LIFESIMULATOR_HPP
+
+class LifeSimulator
+{
+ private:
+ std::uint8_t m_width;
+ std::uint8_t m_height;
+
+ std::vector<std::vector<bool>> m_curr_grid;
+ std::vector<std::vector<bool>> m_buff_grid;
+
+ std::uint8_t getNeighbors(std::uint8_t x, std::uint8_t y) const;
+
+ public:
+ LifeSimulator(std::uint8_t sizeX, std::uint8_t sizeY);
+
+ void insertPattern(const Pattern& pattern, std::uint8_t startX, std::uint8_t startY);
+ void update();
+
+ std::uint8_t getSizeX() const;
+ std::uint8_t getSizeY() const;
+ bool getCell(std::uint8_t x, std::uint8_t y) const;
+};
+
+#endif // LIFESIMULATOR_HPP