In this challenge you will be given a rectangular array representing a "map" with three types of spaces:
Consider the grid:
[
["+", "+", "0", "x", "x", "+", "0"],
["0", "+", "+", "x", "0", "+", "x"]
]
If the top left "+" bomb explodes, the resulting chain reaction will blow up bombs in the order given by the numbers below:
[
["1", "2", "0", "x", "6", "8", "0"],
["0", "3", "4", "5", "0", "7", "8"]
]
Note that there are two 8's since two of the bombs explode at the same time. Also, note that one of the "x" bombs in the top row does not explode.
Write a function that determines if the chain reaction started when the top left bomb explodes destroys all bombs or not.
allExplode([
["+", "+", "+", "+", "+", "+", "x"]
]) ➞ true
allExplode([
["+", "+", "+", "+", "+", "0", "x"]
]) ➞ false
allExplode([
["+", "+", "0", "x", "x", "+", "0"],
["0", "+", "+", "x", "0", "+", "x"]
]) ➞ false
allExplode([
["x", "0", "0"],
["0", "0", "0"],
["0", "0", "x"]
]) ➞ false
allExplode([
["x", "0", "x"],
["0", "x", "0"],
["x", "0", "x"]
]) ➞ true