Golf Challenge
Given the below ASCII "Green".
| |
| |> |
| | |
| O |
| |
| |
| |
| |
| |
| |
Let |
Denote a wall
Let |
Denote half the flag pole
Let >
Denote the flag on the pole
Let O
Denote the hole
Let o
Denote the ball
The dimensions of the "Green" is 10x10. There are ten spaces between the two walls |
.
There are also ten spaces, empty or not between the top and the bottom of the green.
Challenge
Input an x and y value or
generate two random numbers to "shoot" a golf ball onto the green.
If the x, y generated does not touch the hole or the flag pole/flag output "Try Again!"
If the x, y generated hits the hole output "Hole in One!"
if the x, y generated hits the pole output "Lucky Shot!"
if the x, y generated hits the flag output "Close One!"
After the shot, output the location of the ball on the green with a o
, replacing any character it hit. Also output the respective saying above.
Examples:
//Hole in one example, the O was replaced with a o
Randomed x = 3
Randomed y = 4
"Hole in One!"
| |
| |> |
| | |
| o |
| |
| |
| |
| |
| |
| |
//Clone example, the top half of the pole was replaced with a o
Randomed x = 3
Randomed y = 2
"Lucky Shot!"
| |
| o> |
| | |
| O |
| |
| |
| |
| |
| |
| |
//Lucky Shot example, the > was replaced with a o
Randomed x = 4
Randomed y = 2
"Close One!"
| |
| |o |
| | |
| O |
| |
| |
| |
| |
| |
| |
//Try Again example, the <space> was replaced with a o
Randomed x = 5
Randomed y = 1
"Try Again!"
| o |
| |> |
| | |
| O |
| |
| |
| |
| |
| |
| |
Have fun and good luck and as this is code-golf the shortest code wins!