26
Background
This challenge is in honor of apsillers, who won the Not as simple as it looks category in Best of PPCG 2016 with their challenge Can my 4-note music box play that song? Congratulations!
On their "About Me" page, this user has a really neat simulator for the Game of Life cellular automaton. (Seriously, go check it out.) On the other hand, the word aspillera is Spanish for "arrowslit". In light of these facts, this challenge is about arrowslits in Game of Life.
Game of Life arrowslits
In GoL, we will represent an arrow by a glider, and a wall by a sequence of blocks. A single glider approaches the wall from above, and tries to fly through a gap in the wall (the arrowslit). Your task is to check whether the glider passes through the arrowslit or crashes into the wall.
Input
Your input is a grid of bits, which represents a GoL configuration.
You can take it in any reasonable format (multiline string of any two distict printable ASCII characters, list of strings, 2D array of integers, 2D array of booleans etc).
For clarity, I will use multiline strings of the characters .#
in the following.
The input is guaranteed to have several properties.
First, its height is 2N for some N ≥ 6, and its width is at least 2N+2.
The input will be all .
s, except that somewhere on the top three rows is a glider, and on the two middle rows there is a wall of blocks.
The glider will be heading southwest or southeast, and its position is such that if the walls are removed, it will not pass through a side edge before reaching the bottom edge (but it may reach a corner of the grid).
The glider is initially separated from the left and right edges by at least one step of .
s.
It can be in any phase.
The wall consists of blocks, which are separated by one column of .
s, except in one place, where they will be separated by at least two columns of .
s.
Like the glider, the leftmost and rightmost blocks are also separated from the edges by one step of .
s.
There will always be at least one block on the left edge and one block on the right edge.
Here is an example of a valid input grid:
....#......................
..#.#......................
...##......................
...........................
...........................
...........................
.##.##............##.##.##.
.##.##............##.##.##.
...........................
...........................
...........................
...........................
...........................
...........................
Output
As stated, your task is to determine whether the glider crashes into the wall or makes it through to the south edge. For the purposes of this challenge, a crash occurs if the configuration no longer consists of a single glider and the wall of blocks, regardless of what happens later in the simulation. The following diagrams show the smallest gaps that a southeast glider can go through without crashing in the two distinct phases (the condition for southwest gliders is symmetric).
...#...........
.#.#...........
..##...........
...............
...............
##...........##
##...........##
...#...........
....#..........
..###..........
...............
...............
##...........##
##...........##
If the glider flies through the wall, you shall output a truthy value, and otherwise a falsy value. For the example above, the correct output is falsy, since the glider will crash into the left part of the wall.
For the purposes of this challenge, you can assume that if you simulate GoL on the input for 2*(height - 3) steps, the glider is on the bottom row in the expected position and the wall is intact, then the output is truthy.
Rules and scoring
You can write a full program or a function. The lowest byte count wins.
Test cases
I have collected the test cases into a GitHub repository, since they are quite large. Here are links to the individual files:
Is there any reason for including the empty rows below the wall in the input? – Martin Ender – 2017-03-07T15:54:15.170
@MartinEnder They make solutions where you actually simulate GoL on the input more feasible (at least I hope so). – Zgarb – 2017-03-07T15:58:24.203
The glider will always start on the top row? – Rod – 2017-03-07T16:05:16.857
@Rod Yes, it will be on the top row heading southwest or southeast. – Zgarb – 2017-03-07T16:06:09.540
Another game of life :P – Christopher – 2017-03-07T16:18:38.023
Thanks for the interesting challenge! I'm honored.
:)
– apsillers – 2017-03-08T17:40:14.703