32 lines
598 B
C++
32 lines
598 B
C++
/*
|
|
* File name: rules.hpp
|
|
* Author: lejulien
|
|
* Date created: 09-01-2026 23:59:55
|
|
// Date modified: 12-01-2026 21:58:17
|
|
* ------
|
|
*/
|
|
|
|
#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(std::shared_ptr<World> world);
|
|
void newWorld(std::shared_ptr<World> world);
|
|
void update();
|
|
|
|
private:
|
|
std::shared_ptr<World> _world;
|
|
std::vector<bool> _buffer;
|
|
int _width;
|
|
int _height;
|
|
};
|