Coding Golf is a full 18-hole golf game viewed from straight above. A golfer named Fred sneaks onto the island course where he works to play a round and chase the Broken Links trophy. You pick clubs, read the wind and time a classic three-press swing meter. Coding Golf turns distance, angle and wind into a running math problem, one shot at a time. Jasper Renow-Clarke made it for the js13k contest in 2020.

Playing a hole

Each hole is a twisting green fairway surrounded by dark blue sea, from a red tee to a flag on a lighter green. A panel in the top left lists the distance in yards, your stroke, the par and your club. Par runs from 3 to 6 depending on length.

An orange line shows your aim and how far the chosen club carries. There are 19 clubs, from a 1 Wood that carries 278 yards down to a putter that rolls 10. Turn with the arrow keys or the mouse wheel and switch clubs with Up and Down.

Then swing in three presses: start, power, accuracy. Running the needle past 100 makes the game set power for you, with a random sideways error. Sea costs a stroke and returns you to your last spot. Sand stops the ball, and bunker shots lose power and drift. The ball drops once it rests within about 2 yards of the cup.

Coding Golf Controls

Controls for Coding Golf
ActionKeyboardMouse
Start a round, close the scorecardSpace or EnterClick
Turn your aim left or rightLeft and Right arrowsScroll wheel
Change clubUp and Down arrows—
Start the swing, set power, set accuracySpace or Enter (three presses)Click three times
Show the scorecardS—

The math of a good shot

Every swing is an estimate. You compare the distance left with each club’s carry, then adjust for the wind arrow and its mph number. A headwind shortens the shot, a tailwind lengthens it, and a crosswind pushes it sideways. Choosing a club is really a quick subtraction and comparison.

Power adds proportion. A club at 80 percent power carries less than its full distance, so a long club hit softly and a short club hit hard can land in the same place.

Course strategy

  • Check the wind panel before every shot. It changes each time.
  • Do not overswing. Stopping near 100 is fine, going past it is not.
  • Switch to wedges early near the green. They carry 30 to 115 yards.
  • Play the bends of the fairway instead of cutting across water.
  • Watch for bunkers in front of greens, since sand shots can wander up to 10 degrees.
  • Press S to see the scorecard and how you stand against par.

Before You Press Play

There is no music on this version of the game. Each hole shows a result such as Birdie or Bogey, and the card splits into Out and Home nines. For a smaller putting course, try Mini Putt Park. For golf with planets instead of sand, see Gravity Golf.

Tested and updated: