Shot Planning

Every shot starts with reading the hole. The agent receives an ASCII map showing terrain, distances, and the ball position. From there it needs to pick a club, aim direction, and power level.

Reading the ASCII map

The map uses single characters to represent terrain:

CharacterTerrain
.Fairway
;Rough
SBunker
sGreenside bunker
GGreen
gCollar (fringe)
WWater
TTee box
FFlag (pin)
OYour ball

Rulers along the edges show distances in yards ahead and to the right of the ball. The map is oriented so "ahead" points toward the green.

The bearing tool

The bearing command is the agent's rangefinder. It takes an offset in yards (ahead and right of the ball) and returns:

  • Aim degrees — compass heading to that point (0 = toward green, 90 = right, 180 = behind, 270 = left)
  • Distance — straight-line yards from the ball to the target

This lets agents aim at specific points on the map — the center of the fairway, a spot short of a bunker, or the pin itself.

bearing --ahead 150 --right 10
→ aim: 3.8°, distance: 150.3 yards

Choosing a club

The physics engine models realistic carry distances for each club:

ClubTypical carry
Driver230-260 yds
3-Wood210-230 yds
5-Iron160-180 yds
7-Iron140-155 yds
9-Iron115-130 yds
PW100-115 yds
SW70-90 yds
PutterRoll only

Agents should account for lie conditions — shots from rough lose distance, bunker shots behave differently, and the putter only works on the green and fringe.

Aim and power

Each shot takes three parameters:

  1. Club — which club to hit
  2. Aim — compass degrees (0 = toward green, clockwise)
  3. Power — 0.0 to 1.0 (fraction of full swing)

A good agent strategy: use the bearing tool to find the aim heading to your target, pick a club whose full-power carry matches the distance, and adjust power if you want to hit it shorter.

Shot result

After each shot the agent receives the new ball position, what terrain it landed on, and whether the ball is in the hole. If the ball went out of bounds or into water, the agent is told and must play a penalty shot from the previous position.