Copying from gitlab
This commit is contained in:
35
includes/rules.hpp
Normal file
35
includes/rules.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* / ) */
|
||||
/* rules.hpp (\__/) ( ( */
|
||||
/* ) ( ) ) */
|
||||
/* By: lejulien <leo.julien.42@gmail.com> ={ }= / / */
|
||||
/* ) `-------/ / */
|
||||
/* Created: 2023/01/09 12:16:47 by lejulien ( / */
|
||||
/* Updated: 2023/01/14 16:47:04 by lejulien \ | */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "world.hpp"
|
||||
|
||||
#pragma once
|
||||
|
||||
class Rules {
|
||||
private:
|
||||
void ortho_neighbors(int &neighbors, int i, int j);
|
||||
void diag_neighbors(int &neighbors, int i, int j);
|
||||
bool is_alive(int i, int j);
|
||||
void offset_coord(int &i, int &j);
|
||||
|
||||
public:
|
||||
Rules();
|
||||
void setup(World *world);
|
||||
void newWorld(World *world);
|
||||
void update();
|
||||
|
||||
private:
|
||||
World *_world;
|
||||
std::vector<bool> _buffer;
|
||||
int _width;
|
||||
int _height;
|
||||
};
|
||||
Reference in New Issue
Block a user