Let's play code golf... by playing golf.
Your input will be a string consisting of
.'s. For example:
......@.. .....##.. ......... ......o..
. - playable golf course (all shots must end on one of these)
# - a barrier (shots cannot go through this)
o - the starting position of your golf ball
@ - the hole
How to Play ASCII Golf
You start at the
o. Here is a valid shot from point
A to point
1) This shot is straight line that can be drawn between
B (no curved shots).
2) The line
AB may not intersect with a
# (barrier), e.g.:
It may, however, be tangent to a barrier:
3) (For clarity) You may not bounce shots off barriers or the edge of the golf course.
stdout (or an acceptable equivalent) the minimum number of shots to get the ball into the hole
@. If it is not possible, print
=> 2 (you can pass through the vertices of a
#, but not the edges)
o#...# .#.#.# ...#.@