80's Kids #2: Help ALF Find His Spaceship

Late last night in the Tanner household, ALF was repairing his spaceship so he might get back to Melmac. Unfortunately for him, he forgot to put on the parking brake, and the spaceship took off during repair. Now it's hovering in space.

ALF has the technology to bring the spaceship home if he can lock on to its location.

Given a map:

..........
..........
..........
.......X..
..........
..........

The map will be given in the form of a string with \n separating new lines. The bottom left of the map is [0, 0]. X is ALF's spaceship.

In this example:

findSpaceship(map) => [7, 2]
findSpaceship(map) => [7, 2]
find_spaceship(map) => [7, 2]
findSpaceship(map) => "[7, 2]"
findSpaceship(map) => "[7, 2]"

If you cannot find the spaceship, the result should be

Can you help ALF?

Check out my other 80's Kids Katas: 80's Kids #1: How Many Licks Does It Takearrow-up-right 80's Kids #2: Help Alf Find His Spaceshiparrow-up-right 80's Kids #3: Punky Brewster's Socksarrow-up-right 80's Kids #4: Legends of the Hidden Templearrow-up-right 80's Kids #5: You Can't Do That on Televisionarrow-up-right 80's Kids #6: Rock 'Em, Sock 'Em Robotsarrow-up-right 80's Kids #7: She's a Small Wonderarrow-up-right 80's Kids #8: The Secret World of Alex Mackarrow-up-right 80's Kids #9: Down in Fraggle Rockarrow-up-right 80's Kids #10: Captain Planetarrow-up-right

Solutions

🐍 Python

Last updated