Can you beat Uncle Rolf on the golf course?

Uncle Rolf has played golf for 30 years and has a handicap of 4. At least, that's what he says. Nobody has ever seen Rolf write down a bad hole, and it's not because he doesn't have them.

Greenhill Golf Club Scorecard
Hole123Total
Par34512
Joakim35513
Rolf 43 54 65 1512

practice swings, don't count!

Hi 🤗

You may have been asked to solve this assignment in a specific language, but beyond that you are completely free to use whatever frameworks and libraries you like. We look forward to seeing what you choose!

We expect you to spend about 3–6 hours on the assignment, and that the solution ends up at about 200–500 lines of code, depending on language and approach. This is not a requirement, just a rough guide to the expected scope.

Regardless of language, we care about code quality, and we hope you do too! We also hope you give this code the same care you would give production code.

If there is something you would have liked to do but didn't have time for, tell us about it in README.md. That way we can give you some bonus points for it anyway!

The assignment

Uncle Rolf has challenged you to a round, and you have decided to keep an honest scorecard for both of you.

You are going to build a golf game for two players, you and Uncle Rolf. The course and the shots are fetched from separate endpoints.

Rules

Uncle Rolf's scorecard

Rolf keeps his own scorecard, and he has one fixed rule:

On holes where Rolf uses more strokes than par, he writes down one stroke fewer than he actually used.

"The first one was just a practice swing."

Rolf's scorecard is not used to decide who wins, but the program must show what Rolf claims.

The course

The course is available at https://golf.trainops.net/course.

Example

{
  "name": "Greenhill Golf Club",
  "holes": [
    { "number": 1, "par": 3, "length": 150 },
    { "number": 2, "par": 4, "length": 340 },
    { "number": 3, "par": 5, "length": 480 }
  ]
}

The shots

The shots are available at https://golf.trainops.net/shots.

Example

{
  "long": [190, 175, 160, 200],
  "approach": [118, 30, 120, 25, 95, 60],
  "putts": [4, 12, 7, 2, 18]
}

Requirements

Example output

Hole 1 (par 3, 150 m)
  Joakim: 150 → 32 → 2, gimme ⛳ 3 strokes
  Rolf:   150 → 30 → 5 → 1, gimme ⛳ 4 strokes (writes down 3 🙄)
...

Scorecard    | 1 | 2 | 3 | Total
Joakim       | 3 | 5 | 5 | 13
Rolf         | 4 | 5 | 6 | 15
Rolf claims  | 3 | 4 | 5 | 12

🏆 Joakim wins with 13 strokes against Rolf's 15.
🙄 According to Rolf, he won 12–13.

Delivery