高尔夫挑战赛
给定以下ASCII“绿色”。
| |
| |> |
| | |
| O |
| |
| |
| |
| |
| |
| |
让我们代表|
一堵墙
让我们|
代表旗杆的一半
让我们>
代表杆子上的国旗
让我们O
代表孔
让我们o
代表球
“绿色”的尺寸为10x10。两堵墙之间有十个间隔|
。
在果岭的顶部和底部之间还有十个空间,是否为空。
挑战
输入x和y值或生成两个随机数以将高尔夫球“击中”到果岭上。
如果生成的x,y没有碰到孔或旗杆/旗标输出“再试一次!”。
如果生成的x,y碰到孔输出“孔合一!”。
如果生成的x,y击中了极点输出“幸运射击!”
如果生成的x,y到达标志输出“ Close One!”(关闭一个!),
投篮后,用,在果岭上输出球的位置,并o
替换击中的任何字符。还要输出上面的相应说法。
例子:
//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 |
| |
| |
| |
| |
| |
| |
祝您好运和好运,因为这是代码高尔夫,所以最短的代码赢了!