Post History
The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line: The first number is the par of the specific hole. The second nu...
#2: Post edited
- The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line:
- - The first number is the **par** of the specific hole.
- - The second number is the **score** that the player got.
- The program should print the textual golf term for the result, given the par. Trailing spaces or line feed are allowed.
- Par can be a value between 3 to 5 and is the score that the average golf player is expected to get at that hole for their result to be considered fine. A score lower than par is considered good, a score above par is considered bad.
- - A score of 1 is always called "Hole in one".
- - A score of -3 below par is called "Albatross".
- - A score of -2 below par is called "Eagle".
- - A score of -1 below par is called "Birdie".
- - A score of +1 above par is called "Bogey".
- - A score of +2 above par is called "Double bogey".
- - A score of +3 above par is called "Triple bogey".
- Scores higher than +3 above par need not be supported by this program. Thus the score will always be a number between 1 and 5+3=8.
- Examples of input and output:
- 4 4
- Par
- 4 3
- Birdie
- 4 5
- Bogey
- 4 2
- Eagle
- 5 2
- Albatross
- 3 1
- Hole in one
- 4 1
- Hole in one
- 3 6
- Triple bogey
- 5 8
- Triple bogey
- 4 6
- Double bogey
- This is (code) golf, shortest source per language wins.
- The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line:
- - The first number is the **par** of the specific hole.
- - The second number is the **score** that the player got.
- This site's default rules for taking input from stdin or equivalent are also acceptable.
- The program should print the textual golf term for the result, given the par. Trailing spaces or line feed are allowed.
- Par can be a value between 3 to 5 and is the score that the average golf player is expected to get at that hole for their result to be considered fine. A score lower than par is considered good, a score above par is considered bad.
- - A score of 1 is always called "Hole in one".
- - A score of -3 below par is called "Albatross".
- - A score of -2 below par is called "Eagle".
- - A score of -1 below par is called "Birdie".
- - A score of +1 above par is called "Bogey".
- - A score of +2 above par is called "Double bogey".
- - A score of +3 above par is called "Triple bogey".
- Scores higher than +3 above par need not be supported by this program. Thus the score will always be a number between 1 and 5+3=8.
- Examples of input and output:
- 4 4
- Par
- 4 3
- Birdie
- 4 5
- Bogey
- 4 2
- Eagle
- 5 2
- Albatross
- 3 1
- Hole in one
- 4 1
- Hole in one
- 3 6
- Triple bogey
- 5 8
- Triple bogey
- 4 6
- Double bogey
- This is (code) golf, shortest source per language wins.
#1: Initial revision
Golf golf challenge
The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line:
- The first number is the **par** of the specific hole.
- The second number is the **score** that the player got.
The program should print the textual golf term for the result, given the par. Trailing spaces or line feed are allowed.
Par can be a value between 3 to 5 and is the score that the average golf player is expected to get at that hole for their result to be considered fine. A score lower than par is considered good, a score above par is considered bad.
- A score of 1 is always called "Hole in one".
- A score of -3 below par is called "Albatross".
- A score of -2 below par is called "Eagle".
- A score of -1 below par is called "Birdie".
- A score of +1 above par is called "Bogey".
- A score of +2 above par is called "Double bogey".
- A score of +3 above par is called "Triple bogey".
Scores higher than +3 above par need not be supported by this program. Thus the score will always be a number between 1 and 5+3=8.
Examples of input and output:
4 4
Par
4 3
Birdie
4 5
Bogey
4 2
Eagle
5 2
Albatross
3 1
Hole in one
4 1
Hole in one
3 6
Triple bogey
5 8
Triple bogey
4 6
Double bogey
This is (code) golf, shortest source per language wins.
