I would like to code a reversible rule family using your design, but would like to completely understand the specifications before starting. There seems to be an inconsistency. Your code here:
Code: Select all
int adjacentCount =
(squareCell.getNeighbor(r - 1, c ) % 2) +
(squareCell.getNeighbor(r + 1, c ) % 2) +
(squareCell.getNeighbor(r , c - 1) % 2) +
(squareCell.getNeighbor(r , c + 1) % 2);
int diagonalCount =
(squareCell.getNeighbor(r - 1, c - 1) % 2) +
(squareCell.getNeighbor(r - 1, c + 1) % 2) +
(squareCell.getNeighbor(r + 1, c + 1) % 2) +
(squareCell.getNeighbor(r + 1, c - 1) % 2);
int cell = squareCell.getNeighbor(r, c);
int cond = ruleTable[cell % 2][adjacentCount][diagonalCount];
Code: Select all
0 1 0
0 2 0
0 3 0
0 4 0
1 1 0
1 2 0
1 3 0
1 4 0
Brian