Background
The 4-8-8 tiling looks like this:
Image may be NSFW.
Clik here to view.
For the purpose of this challenge, we take the orientation of the tiling as exactly shown above. In plain English words, we take the tiling so that it can be seen as a rectangular grid of alternating octagons and squares, the upper left corner being an octagon.
In order to define a Game of Life on this tiling, we use a simplified definition of neighborhood: cell B is a neighbor of cell A if the two cells share an edge. An octagon has at most 8 neighbors and a square has at most 4. We assume the cells outside the given grid are simply non-existent (or alternatively, hardwired as all dead).
Other than the grid differences, we use the rules of Game of Life as-is:
- An off-cell is turned on if it has exactly three on-neighbors, and is kept off otherwise.
- An on-cell is kept on if it has exactly two or three on-neighbors, and is turned off otherwise.
Challenge
Given a rectangular grid of on- and off-cells on the 4-8-8 tiling as defined above, calculate the next generation in Game of Life.
The on- and off-cells can be represented by any two distinct, consistent values respectively. The rectangular grid may be represented in any suitable format supported by your language. The output format doesn't need to be the same as the input format. The grid can be assumed to have at least two rows and two columns.
Standard code-golf rules apply. The shortest code in bytes wins.
Test cases
Generated using this Python program.
For simplicity, the grid is represented as a list of lists of zeros (off) and ones (on). Some test cases have multiple steps, which means if your program is given the first state, it should produce the second, and if given the second, it should produce the third, etc.
[[1, 1], [1, 1]] -> unchanged[[1, 1], [0, 1]] -> unchanged[[1, 1], [1, 0]] ->[[1, 0], [0, 1]] ->[[0, 0], [0, 0]][[0, 0, 0], [1, 1, 1], [0, 0, 0]], ->[[0, 0, 0], [0, 1, 0], [0, 0, 0]][[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]] ->[[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0]] -> back to first[[1, 0, 0, 1, 1], [1, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 1, 1], [1, 1, 0, 0, 1]] ->[[1, 0, 1, 1, 1], [1, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 1, 1, 1], [1, 1, 1, 0, 1]] ->[[1, 1, 0, 1, 1], [1, 0, 1, 0, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 1], [1, 1, 0, 1, 1]] ->[[1, 0, 1, 0, 1], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1], [0, 0, 0, 0, 0], [1, 0, 1, 0, 1]] ->[[0, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 0], [0, 1, 0, 1, 0], [0, 0, 0, 0, 0]] -> all zeros