Back to winniegolf
SOURCE / PINNED RELEASE

Made of little things.

winniegolf

Release
017b791c0f4b…
Author-recorded commit
612845c125fd…
License
LICENSE
Author’s source reference
nostr://npub18weq5jzw27gkhwcuf6gu57alcptjdvh78nlulgpkz8s7pnlxfnnspc00s9/wss%3A%2F%2Fgit.napplet.soy%2F/n-2d501957e21

Archive hash verified: 713b42364f27a576…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

src/game/levels.ts
import type { Level, Rect } from './types.js';

/** Logical course size. Every hole is authored in this space and scaled to fit. */
export const COURSE_W = 560;
export const COURSE_H = 400;

/** Rail thickness around the outside of a hole. */
const RAIL = 16;

function frame(w: number, h: number): Rect[] {
  return [
    { x: 0, y: 0, w, h: RAIL },
    { x: 0, y: h - RAIL, w, h: RAIL },
    { x: 0, y: RAIL, w: RAIL, h: h - RAIL * 2 },
    { x: w - RAIL, y: RAIL, w: RAIL, h: h - RAIL * 2 },
  ];
}

/**
 * Holes in play order. Difficulty rises by the kind of challenge introduced:
 * open -> bank -> bunker and gate -> moving blade -> water -> sand-plus-blade
 * -> twin bridges. New holes are appended; `ROUND_PAR` is derived.
 */
export const LEVELS: Level[] = [
  {
    id: 1,
    name: 'First Light',
    hint: 'A clean line to the cup.',
    par: 2,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 85, y: 300 },
    cup: { x: 475, y: 110 },
    walls: [
      ...frame(COURSE_W, COURSE_H),
      { x: 230, y: 40, w: 80, h: 70 },
      { x: 300, y: 290, w: 80, h: 70 },
    ],
    sand: [],
    land: null,
    bumpers: [],
    spinners: [],
  },
  {
    id: 2,
    name: 'Dogleg',
    hint: 'Thread the gap on the right, then bank back to the cup.',
    par: 3,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 80, y: 320 },
    cup: { x: 170, y: 70 },
    walls: [
      ...frame(COURSE_W, COURSE_H),
      { x: RAIL, y: 170, w: 360, h: 18 },
      { x: 280, y: 90, w: 90, h: 60 },
    ],
    sand: [],
    land: null,
    bumpers: [],
    spinners: [],
  },
  {
    id: 3,
    name: 'Sandbar',
    hint: 'Carry the bunker, then thread the gate.',
    par: 3,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 80, y: 193 },
    cup: { x: 500, y: 193 },
    walls: [
      ...frame(COURSE_W, COURSE_H),
      { x: 390, y: RAIL, w: 70, h: 120 },
      { x: 390, y: 250, w: 70, h: 134 },
    ],
    sand: [{ x: 170, y: RAIL, w: 150, h: COURSE_H - RAIL * 2 }],
    land: null,
    bumpers: [],
    spinners: [],
  },
  {
    id: 4,
    name: 'Windmill',
    hint: 'Time the blade, then thread the gate.',
    par: 5,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 80, y: 340 },
    cup: { x: 510, y: 133 },
    walls: [
      ...frame(COURSE_W, COURSE_H),
      { x: 400, y: RAIL, w: 70, h: 90 },
      { x: 400, y: 160, w: 70, h: 80 },
    ],
    sand: [],
    land: null,
    bumpers: [
      { x: 120, y: 90, r: 24 },
      { x: 470, y: 310, r: 24 },
    ],
    spinners: [{ cx: 250, cy: 200, half: 120, thick: 16, speed: 1.7, phase: 0 }],
  },
  {
    id: 5,
    name: 'Island Green',
    hint: 'Stay on the dry line. Water costs a stroke.',
    par: 4,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 110, y: 325 },
    cup: { x: 455, y: 85 },
    walls: frame(COURSE_W, COURSE_H),
    sand: [],
    land: [
      { x: 40, y: 280, w: 150, h: 90 },
      { x: 190, y: 300, w: 210, h: 45 },
      { x: 365, y: 130, w: 45, h: 170 },
      { x: 365, y: 40, w: 155, h: 90 },
    ],
    bumpers: [],
    spinners: [],
  },
  {
    id: 6,
    name: 'Millrace',
    hint: 'Firm carry over the sand, then time the blade before the gate.',
    par: 5,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 80, y: 320 },
    cup: { x: 500, y: 80 },
    walls: [
      ...frame(COURSE_W, COURSE_H),
      { x: 410, y: RAIL, w: 60, h: 110 },
      { x: 410, y: 260, w: 60, h: 124 },
    ],
    sand: [{ x: 140, y: RAIL, w: 110, h: COURSE_H - RAIL * 2 }],
    land: null,
    bumpers: [{ x: 500, y: 310, r: 24 }],
    spinners: [{ cx: 315, cy: 193, half: 90, thick: 16, speed: 1.7, phase: 0 }],
  },
  {
    id: 7,
    name: 'Toll Bridge',
    hint: 'Two narrow bridges, and the pegs will happily pay your toll.',
    par: 5,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 100, y: 320 },
    cup: { x: 480, y: 55 },
    walls: frame(COURSE_W, COURSE_H),
    sand: [],
    land: [
      { x: 40, y: 260, w: 140, h: 110 },
      { x: 178, y: 300, w: 102, h: 50 },
      { x: 270, y: 150, w: 130, h: 200 },
      { x: 330, y: 90, w: 50, h: 70 },
      { x: 300, y: 20, w: 220, h: 80 },
    ],
    bumpers: [
      { x: 310, y: 230, r: 24 },
      { x: 375, y: 180, r: 24 },
    ],
    spinners: [],
  },
  {
    id: 8,
    name: 'Needle',
    hint: 'Pick a side of the pillar, then ease it past the pegs — long and it dies in the sand behind the cup.',
    par: 5,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 80, y: 200 },
    cup: { x: 495, y: 200 },
    walls: [
      ...frame(COURSE_W, COURSE_H),
      { x: 270, y: 180, w: 40, h: 40 },
    ],
    sand: [
      { x: 150, y: RAIL, w: 260, h: 120 },
      { x: 150, y: 264, w: 260, h: 120 },
      { x: 518, y: 150, w: 26, h: 100 },
    ],
    land: null,
    bumpers: [
      { x: 190, y: 200, r: 24 },
      { x: 445, y: 145, r: 24 },
      { x: 445, y: 255, r: 24 },
    ],
    spinners: [],
  },
  {
    id: 9,
    name: 'Riptide',
    hint: 'Up the channel, then cross the bridge only when the blade swings in line.',
    par: 5,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 90, y: 320 },
    cup: { x: 440, y: 300 },
    walls: frame(COURSE_W, COURSE_H),
    sand: [],
    land: [
      { x: 30, y: 250, w: 150, h: 120 },
      { x: 120, y: 120, w: 50, h: 140 },
      { x: 120, y: 80, w: 280, h: 50 },
      { x: 350, y: 128, w: 50, h: 122 },
      { x: 300, y: 230, w: 200, h: 120 },
    ],
    bumpers: [{ x: 360, y: 290, r: 24 }],
    spinners: [{ cx: 92, cy: 175, half: 66, thick: 16, speed: 1.7, phase: 1.57 }],
  },
  {
    id: 10,
    name: 'Crucible',
    hint: 'Three crossings, one choke, and the blade never sleeps — everything you have learned, at once.',
    par: 5,
    w: COURSE_W,
    h: COURSE_H,
    tee: { x: 90, y: 330 },
    cup: { x: 490, y: 50 },
    walls: frame(COURSE_W, COURSE_H),
    sand: [{ x: 300, y: 195, w: 50, h: 40 }],
    land: [
      { x: 30, y: 260, w: 150, h: 110 },
      { x: 175, y: 300, w: 95, h: 50 },
      { x: 255, y: 185, w: 135, h: 165 },
      { x: 300, y: 85, w: 50, h: 115 },
      { x: 320, y: 20, w: 200, h: 130 },
    ],
    bumpers: [
      { x: 310, y: 240, r: 24 },
      { x: 355, y: 300, r: 24 },
      { x: 495, y: 115, r: 24 },
    ],
    spinners: [{ cx: 420, cy: 85, half: 55, thick: 16, speed: 1.7, phase: 0 }],
  },
];

/** Par for the whole round. */
export const ROUND_PAR = LEVELS.reduce((sum, level) => sum + level.par, 0);