CellularAutomata
Loading...
Searching...
No Matches
CellularAutomata::States::Objects Namespace Reference

Some predefined objects of Conway's Game of Life. More...

Functions

template<typename T >
void copyInto (T *src, const unsigned int src_h, const unsigned int src_w, T *dst, const unsigned int dst_h, const unsigned int dst_w, const unsigned int y, const unsigned int x)
 Copy an (small) array into another (large) array at a given position.
 
template<typename T >
void Glider (State< T > *state, const unsigned int x, const unsigned int y)
 Copies a glider (3x3) into given position (https://conwaylife.com/wiki/Glider)
 
template<typename T >
void Spaceship (State< T > *state, const unsigned int x, const unsigned int y)
 Copies a spaceship (4x5) into given position (https://conwaylife.com/wiki/Spaceship)
 
template<typename T >
void Bipole1 (State< T > *state, const unsigned int x, const unsigned int y)
 Copies a bipole (4x4) into given position (https://conwaylife.com/wiki/Bipole)
 
template<typename T >
void Bipole2 (State< T > *state, const unsigned int x, const unsigned int y)
 Copies a (alternative) bipole (5x5) into given position (https://conwaylife.com/wiki/Bipole)
 
template<typename T >
void r_Pentomino (State< T > *state, const unsigned int x, const unsigned int y)
 Copies a R-pentomino (3x3) into given position (https://conwaylife.com/wiki/R-pentomino)
 

Detailed Description

Some predefined objects of Conway's Game of Life.

Function Documentation

◆ Bipole1()

template<typename T >
void CellularAutomata::States::Objects::Bipole1 ( State< T > *  state,
const unsigned int  x,
const unsigned int  y 
)

Copies a bipole (4x4) into given position (https://conwaylife.com/wiki/Bipole)

Attention
State MUST be on CPU. No checks are done if the size is valid at the given position
Note
The copy is top-left aligned
Template Parameters
Ttype
Parameters
statestate on CPU
xX-position
yY-position

◆ Bipole2()

template<typename T >
void CellularAutomata::States::Objects::Bipole2 ( State< T > *  state,
const unsigned int  x,
const unsigned int  y 
)

Copies a (alternative) bipole (5x5) into given position (https://conwaylife.com/wiki/Bipole)

Attention
State MUST be on CPU. No checks are done if the size is valid at the given position
Note
The copy is top-left aligned
Template Parameters
Ttype
Parameters
statestate on CPU
xX-position
yY-position

◆ copyInto()

template<typename T >
void CellularAutomata::States::Objects::copyInto ( T *  src,
const unsigned int  src_h,
const unsigned int  src_w,
T *  dst,
const unsigned int  dst_h,
const unsigned int  dst_w,
const unsigned int  y,
const unsigned int  x 
)
inline

Copy an (small) array into another (large) array at a given position.

Note
The copy is top-left aligned
Template Parameters
Ttype
Parameters
srcsmall source array
src_hsource height
src_wsource width
dstlarge destination array
dst_wdestination width
dst_hdestination height
yY insert position
xX insert position
Exceptions
OutOfBounds

◆ Glider()

template<typename T >
void CellularAutomata::States::Objects::Glider ( State< T > *  state,
const unsigned int  x,
const unsigned int  y 
)

Copies a glider (3x3) into given position (https://conwaylife.com/wiki/Glider)

Attention
State MUST be on CPU. No checks are done if the size is valid at the given position
Note
The copy is top-left aligned
Template Parameters
Ttype
Parameters
statestate on CPU
xX-position
yY-position

◆ r_Pentomino()

template<typename T >
void CellularAutomata::States::Objects::r_Pentomino ( State< T > *  state,
const unsigned int  x,
const unsigned int  y 
)

Copies a R-pentomino (3x3) into given position (https://conwaylife.com/wiki/R-pentomino)

Attention
State MUST be on CPU. No checks are done if the size is valid at the given position
Note
The copy is top-left aligned
Template Parameters
Ttype
Parameters
statestate on CPU
xX-position
yY-position

◆ Spaceship()

template<typename T >
void CellularAutomata::States::Objects::Spaceship ( State< T > *  state,
const unsigned int  x,
const unsigned int  y 
)

Copies a spaceship (4x5) into given position (https://conwaylife.com/wiki/Spaceship)

Attention
State MUST be on CPU. No checks are done if the size is valid at the given position
Note
The copy is top-left aligned
Template Parameters
Ttype
Parameters
statestate on CPU
xX-position
yY-position