circulartransition.cpp 358 Bytes
Newer Older
1
2
3
4
5
6
#include "circulartransition.hpp"

unsigned CircularTransition::getState(unsigned cell, const Neighborhood &neighborhood) const
{
    unsigned next_state = (cell+1) % states.val;
    unsigned next_state_neighbors = neighborhood.getNb(next_state);
7
    if ((int)next_state_neighbors >= threshold.val)
8
9
10
11
        return next_state;
    else
        return cell;
}