We already have challenges dealing with simulating vanilla Conway's Game of Life, Wireworld and rule 110, but so far none corresponding to a (specific) non-totalistic rule. So here is one.
In June 2000 David Bell described the Just Friends rule, which uses the same square grid and two states as regular Life but has the following transitions:
- A live cell remains live iff it has one or two live neighbours
- A dead cell becomes live iff it has two live neighbours and they are not vertically or horizontally adjacent
The birth restriction prevents the explosive behaviour that would otherwise be seen with birth-on-2-neighbours rules such as Seeds, and instead allows many interesting patterns. I've been searching for small oscillators of every period in this rule using apgsearch, and by that program alone I have found a stable reflector.
Task
Given a Just Friends input pattern and number of generations, output the resulting pattern. The simulation grid, if bounded, must have size at least 40×40 and use either of the following boundary conditions:
- Wrap around like a torus
- Off-grid cells are dead
Pattern input and output may be in any reasonable format, such as binary matrices, lists of live cell positions and RLE.
This is code-golf; fewest bytes wins.
Test cases
These are in the form
input pattern
number of generations
output pattern.
....
.*..
.**.
....
1
....
.*..
.**.
....
......
..*...
..*...
.*....
......
......
......
12
......
......
......
....*.
....*.
...*..
......
.................
........*........
.................
......*.*........
.................
.**..............
.......**........
.................
.................
.................
.................
.................
.................
59
.................
.................
.................
.................
.........*.*..*..
..............*..
...........*.....
.................
.................
.................
.............*...
.............*...
.................
........................
...........*............
........................
......*....*.*..........
......*.................
.............*...*......
.....*.*...........**...
.................*......
........................
........................
...*.*..................
....................*.*.
.*.*....................
..................*.*...
........................
........................
......*.................
...**...........*.*.....
......*...*.............
.................*......
..........*.*....*......
........................
............*...........
........................
29
........................
............*...........
........................
..........*.*....*......
.................*......
......*...*.............
...**...........*.*.....
......*.................
........................
........................
..................*.*...
.*.*....................
....................*.*.
...*.*..................
........................
........................
.................*......
.....*.*...........**...
.............*...*......
......*.................
......*....*.*..........
........................
...........*............
........................
...............
.*.............
.*.***.........
..*...**.......
.....*..*......
..*...**.......
.*.***.........
.*.............
...............
15
...............
....*..........
....*.*****....
.....*.....**..
..........*..*.
.....*.....**..
....*.*****....
....*..........
...............
...........................
..........*.....*..........
..........*.....*..........
...........................
...........................
...........................
...........................
...........................
.*.......................*.
.*.........**.**.........*.
.*.......................*.
.*.........**.**.........*.
.*.......................*.
...........................
...........................
...........................
...........................
...........................
..........*.....*..........
..........*.....*..........
...........................
83
...........................
..........*.....*..........
..........*.....*..........
...........................
...........................
...........................
...........................
...........................
.*.......................*.
.*.........**.**.........*.
.*.......................*.
.*.........**.**.........*.
.*.......................*.
...........................
...........................
...........................
...........................
...........................
..........*.....*..........
..........*.....*..........
...........................
...........
..*........
..*......*.
....*....*.
.***.....*.
....*....*.
..*......*.
..*........
...........
21
...........
..*........
..*......*.
....*....*.
.***.....*.
....*....*.
..*......*.
..*........
...........
...............
...............
..**.**.*****..
..*.*.*.*****..
...***..**.**..
..*.*.*.*****..
..**.**.*****..
...............
...............
1
...............
....*..*.......
..*...*........
...............
.*.............
...............
..*...*........
....*..*.......
...............