Remember the game Battleship? Ships are floating in a matrix. You have to fire torpedos at their suspected coordinates, to try and hit them.
Create a function that takes a list of lists (matrix) and a coordinate as a string. If the coordinate contains only water ".", return "splash" and if the coordinate contains a ship "*", return "BOOM".
Instruction text contains two blank spaces between quotation marks; the code/test does not. See examples below.
[
[".", ".", ".", "*", "*"],
[".", "*", ".", ".", "."],
[".", "*", ".", ".", "."],
[".", "*", ".", ".", "."],
[".", ".", "*", "*", "."],
]
fire(matrix, "A1") ➞ "splash"
fire(matrix, "A4") ➞ "BOOM"
fire(matrix, "D2") ➞ "BOOM"