This commit is contained in:
2019-11-05 19:01:33 -07:00
parent dea67dc3c0
commit ae02863a60
12 changed files with 99 additions and 0 deletions

2
Hw6/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

2
Hw6/.idea/Hw6.iml generated Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

4
Hw6/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
Hw6/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Hw6.iml" filepath="$PROJECT_DIR$/.idea/Hw6.iml" />
</modules>
</component>
</project>

6
Hw6/.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@@ -1,4 +1,9 @@
//
// Created by Brady Bodily on 11/5/19.
//
#include "LifeSimulator.hpp"
LifeSimulator::LifeSimulator(std::uint8_t sizeX, std::uint8_t sizeY) :
sizeX(sizeX), sizeY(sizeY) {
}

View File

@@ -5,4 +5,20 @@
#ifndef CS3460_CPP_LIFESIMULATOR_HPP
#define CS3460_CPP_LIFESIMULATOR_HPP
#include <cstdint>
#include "Pattern.hpp"
class LifeSimulator
{
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 //CS3460_CPP_LIFESIMULATOR_HPP

View File

@@ -5,4 +5,14 @@
#ifndef CS3460_CPP_PATTERN_HPP
#define CS3460_CPP_PATTERN_HPP
#include <cstdint>
class Pattern
{
public:
virtual std::uint8_t getSizeX() const = 0;
virtual std::uint8_t getSizeY() const = 0;
virtual bool getCell(std::uint8_t x, std::uint8_t y) const = 0;
};
#endif //CS3460_CPP_PATTERN_HPP

View File

@@ -3,3 +3,13 @@
//
#include "PatternGlider.hpp"
PatternGlider::PatternGlider() : X(5), Y(5)
{
cells[3][1];
cells[3][2];
cells[3][3];
cells[2][3];
cells[1][2];
}

View File

@@ -5,4 +5,28 @@
#ifndef CS3460_CPP_PATTERNGLIDER_HPP
#define CS3460_CPP_PATTERNGLIDER_HPP
#include <array>
#include "Pattern.hpp"
class PatternGlider : public Pattern
{
private:
int X;
int Y;
std::array<std::array<bool, 5>, 5> cells;
public:
PatternGlider();
int getSizeX()
{
return X;
};
int getSizeY(){
return Y;
};
bool getCell(int x, int y){
return cells[x][y];
};
};
#endif //CS3460_CPP_PATTERNGLIDER_HPP

View File

@@ -5,4 +5,12 @@
#ifndef HW6_RENDER_HPP
#define HW6_RENDER_HPP
#include "LifeSimulator.hpp"
class Renderer
{
public:
virtual void render(const LifeSimulator& simulation) = 0;
};
#endif //HW6_RENDER_HPP

View File

@@ -2,3 +2,7 @@
// Created by Brady Bodily on 11/5/19.
//
int main(){
return 0;
}