32 lines
549 B
C++
32 lines
549 B
C++
/*
|
|
* File name: rules.hpp
|
|
* Author: lejulien
|
|
* Date created: 09-01-2026 23:59:55
|
|
* Date modified: 10-01-2026 21:49:44
|
|
* ------
|
|
*/
|
|
|
|
#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;
|
|
};
|