parallel-cellular-automata
Framework for building parallel cellular automata.
|
Sequential Cellular Automaton. More...
#include <sequential_automaton.hpp>
Public Member Functions | |
CellularAutomaton (Grid< T > &grid, std::function< T(T, T, T, T, T, T, T, T, T)> update_function) | |
Construct a new Cellular Automaton object. More... | |
CellularAutomaton (CellularAutomaton &&other) | |
Construct a new Cellular Automaton object from another one using move semantic. More... | |
CellularAutomaton (const CellularAutomaton &other)=delete | |
Deleted copy constructor. More... | |
virtual void | simulate (unsigned steps=1) |
Run the simulation for a given number of steps. More... | |
virtual size_t | get_generation () const |
Get the generation of the simulation. More... | |
Protected Member Functions | |
virtual std::tuple< T, T, T, T, T, T, T, T > | get_neighborhood (int row, int col) const |
Get the neighborhood of a cell. More... | |
Protected Attributes | |
Grid< T > & | grid |
Grid of the C.A. | |
size_t | generation |
Current generation of the grid. | |
std::function< T(T, T, T, T, T, T, T, T, T)> | update_function |
Function used to compute the next state of the cell. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CellularAutomaton &ca) |
Overload of the << operator. More... | |
Sequential Cellular Automaton.
This class implements a toroidal Cellular Automaton.
T | type of the cells. |
|
inline |
Construct a new Cellular Automaton object.
grid | Grid of the simulation. |
update_function | Function used to update the state of the grid. |
|
inline |
Construct a new Cellular Automaton object from another one using move semantic.
other | CellularAutomaton to move. |
|
delete |
Deleted copy constructor.
|
inlinevirtual |
Get the generation of the simulation.
|
inlineprotectedvirtual |
Get the neighborhood of a cell.
row | row of the center cell. |
col | column of the center cell. |
|
inlinevirtual |
Run the simulation for a given number of steps.
steps | number of simulation steps to run (default 1). |
|
friend |
Overload of the << operator.
Print the grid on a output stream.
os | output stream |
ca | CellularAutomaton |
|
protected |
Function used to compute the next state of the cell.
The function takes nine arguments. It will be called by passing the central cell as first argument and its eight neighbors as the remaining arguments. Their order is the one returned by the get_neighborhood function.