Today is November 11th, which for many regions is Remembrance Day.
If you don't know anything about the history or context of Remembrance Day, you can read about it in the wiki page, but it's not relevant for this challenge.
In Flanders Fields is a poem that is pretty well-known relating to this day. It opens like so:
In Flanders fields the poppies blow
Between the crosses, row on row
Challenge
You will be given a grid with crosses (represented below as +
) on it. Your task is to grow poppies between all crosses. That is, fill the space between any two crosses that are on the same row or column with poppies (represented below as *
).
Example
....+....
...+.+...
.........
....+....
..+...+..
.........
..+...+..
This becomes:
....+....
...+*+...
....*....
....+....
..+***+..
..*...*..
..+***+..
Rigorously defined, on a non-cylindrical grid, each grid space is +
if it was +
, and becomes *
if it has a +
in the same column above and below it, or in the same row to its left and right.
Test Cases
.....+... .....+...
+......+. +******+.
....+.+.. -> *...+*+..
+.+...+.. +*+***+..
...++.+.. ...++*+..
.+..... .+.....
....+.. .*..+..
...+..+ .*.+**+
.+++... .+++*.*
....... -> .****.*
.+++.+. .+++*+*
.++.++. .++*++*
....... .*....*
.+....+ .+****+
....... .......
...+... ...+...
.....++ .....++
++..... ++...**
+....+. -> +****+*
.....+. .....+*
....... ......*
....... ......*
..+...+ ..+***+
.+.+.. .+*+..
.....+ .*.*.+
+..... +*.*.*
.+.... .+.*.*
...+.+ -> ...+*+
...... ......
...... ......
....+. ....+.
Rules and Specifications
Input requires a grid of two distinct values. You can take this in any convenient format, and you can choose to use any reasonable convenient values, like 0
and 1
, for example.
Output requires a grid of three distinct values. Again, you can deliver this in any reasonable, convenient format.
Standard loopholes apply.
This is a code-golf challenge, so the shortest solution in each language wins. No answer will be accepted.
(Sorry for posting another challenge, especially another ascii-art one, so soon, but I really wanted to do something for 11/11 and I thought of it after my pattern expansion one)