Home › JWorld Blog

"Same shot, same result" in Putt Workshop: integer shots, a 240 Hz tick, physics with no dice

JWorld team ·

How Putt Workshop makes puzzles solvable by thinking instead of luck. Two-integer shots, a fixed time step, friction and cup rules, home-made sin/cos, hash checks, and how a solver sets par.

Putt Workshop has no accuracy meter, no wind and no random wobble. Place the same devices on the same hole, hit with the same angle and power, and the ball stops in exactly the same spot. Today, tomorrow, on a phone or on a desktop.

That sounds simple, but it does not happen by accident. The JWorld team wrote the physics engine by hand and nailed a few rules into the code to keep that promise. This article is based on the game's design document and its core source. If you want to know how each device behaves, the earlier guide covers that. Here we look at the machinery. You can play it in your browser.

Hole 1 on the course. The top bar shows Par 2 and Strokes 0/4, and an arrow runs up and to the right from the ball with a power bar at 83%
Hole 1 on the course. The top bar shows Par 2 and Strokes 0/4, and an arrow runs up and to the right from the ball with a power bar at 83%

A shot is two integers

The engine accepts exactly two numbers per stroke.

  • a: the angle, an integer in tenths of a degree, from 0 to 3599.
  • p: the power, an integer in thousandths, from 80 to 1000.

When you drag on the screen, the game converts pixel positions into these two integers and hands them to the engine. So the whole space of possible shots is 3,600 angles times 921 powers, about 3.3 million shots in total. There is no room for a fractional finger wobble to leak into the result. The start speed is 600 × p / 1000 units per second. The unit "u" is a course unit, and every hole is the same 400 × 640 u field no matter how big your screen is. Only the drawing is scaled. The engine does not know your screen exists.

A 1/240 s tick, four per frame

Time is fixed too. The engine only moves in steps of 1/240 of a second, called ticks. The screen draws at 60 Hz, so each frame runs four ticks. If a slow phone drops a frame, the order and size of the ticks stay the same. Only the picture arrives late.

A fixed tick has another benefit. The ball's top speed is 720 u/s, which is 3 u per tick. The ball's radius is 6 u, so it moves at most half a radius at a time and cannot skip over a thin wall. A single stroke runs for at most 6,000 ticks, which is 25 seconds. If the ball has not stopped by then, the engine stops it.

Friction is a constant slowdown

Each surface slows the ball by a constant amount against its motion, in u/s².

SurfaceSlowdownRoll distance at full power
Grass260about 692 u
Sand900about 200 u
Ice60about 3,000 u

The last column is speed² ÷ (2 × slowdown) with a full-power speed of 600 u/s. The field is 640 u tall, so a full-power shot on grass crosses almost the whole course once, while on ice the ball keeps going long after several wall bounces. Slopes add an acceleration per zone. A gentle slope (60) cannot move a resting ball, and a steep slope (120) can. The ball counts as stopped when it is slower than 8 u/s and the slope pull is under 90 u/s².

A wall keeps 0.80 of the speed that hits it head-on and 0.98 of the speed along it. A fixed post returns 0.85 of the head-on speed. All of these numbers live in one file, params.ts.

The cup lets slow balls in

The cup radius is 14 u. The ball's center must come within 14 u of the cup's center and be slower than 330 u/s to drop in. A faster ball rolls right over it. That is why a hard shot straight at the cup can miss.

There is also a small assist near the cup. A ball within 30 u of the center and slower than 260 u/s is pulled toward the cup at 700 u/s². According to the design notes, it is there to forgive the small errors you get when aiming with a finger. It is a fixed rule, not a random one, so the same shot is pulled in the same way.

Even sin and cos are home-made

To turn an angle into a direction you need sine and cosine. But Math.sin and Math.cos may differ in the last digit between JavaScript engines. You cannot see the difference, but after a ball bounces off walls dozens of times it can add up to "in" versus "out".

So the core code uses only + − × ÷ √ and comparisons. Sine and cosine are built from Taylor series: the angle is reduced to between -π/4 and π/4, fed into a polynomial, and then the sign and slot are swapped according to the quadrant. A comment in the code says the error is below 1e-12. A test bans Math.sin, Math.cos, Math.atan2 and Math.pow in the core folder.

There are no random numbers inside the physics either. A random generator (mulberry32) exists, but it is used only for bot aiming error, solver sampling and tests.

Same hash, down to the bit

"The same" is not judged by eye. The ball's state is turned into a hash from the exact bits of its floating-point numbers, and the hashes are compared. The tests check this:

CheckWhat it does
Random shots1,000 shots run twice must give identical hashes
Golden replays20 replays have their hashes pinned in a file
Browser matchThe final hash from a browser must equal the one from Node. The 2026-10-20 measurement matched on 680 shots across 17 holes
Physics freezeChanging the physics folder, even by one character, fails a test

The last row matters. For a solution you already found to keep working after an update, the engine must not change. So the physics files are pinned by hash, and changing them first requires proving that the golden replays still come out the same.

A solver sets par

A deterministic engine allows one more thing: a computer can play the hole for us. The solver simulates thousands of shots with the very same engine.

  • The shot grid is every 1° (360 angles) times 12 power levels, which is 4,320 shots per stroke.
  • Devices are tried every 20 u, in 8 directions.
  • Spots where the ball stops are grouped into 20 u cells, and the next stroke is tested from each group.
  • The budget is counted in simulated strokes, not seconds, so the same hole gives the same answer whenever you run it.

The smallest stroke count the solver finds is the hole's par. A hole only passes if no device-free shortcut reaches par on the grid. One honest note: this check is "proof inside the grid". A shortcut could hide between grid points, so shortcuts get one more search on a finer grid (0.5° times 24 power levels).

Hints are shaken before they are used

Having a solution does not make it a good hint. A solution that works only at one exact angle and power is hard to copy by hand. So the first shot of a hint is shaken by ±0.5° and ±2%, which gives 105 variants (21 × 5). Each is simulated, and the hint is accepted only if at least 90% of them still make par. When there are several solutions, the widest one is picked.

The Device hint and Aim hint you see after tapping Show hint when stuck come from solutions vetted this way, so following a hint should not leave you a hair short.

Hole 1 of Pond Edge. The top bar shows Par 2 and Strokes 0/4, a bridge sits over the water band, and the bridge card is in the device tray at the bottom
Hole 1 of Pond Edge. The top bar shows Par 2 and Strokes 0/4, a bridge sits over the water band, and the bridge card is in the device tray at the bottom

What this means when you play

Knowing the structure changes how you solve:

  1. A miss is information. The same shot gives the same result, so if it missed, the shot or the devices must change. Replaying the same shot teaches nothing.
  2. Nudge the power. Because of the 330 u/s cup limit, harder is not always better.
  3. Move the angle one step at a time. Even 0.1° can grow into a big gap after a few wall bounces.
  4. Undo costs nothing. By design, it is there so you can experiment.

Summary

  • A shot is an angle a and a power p, two integers, about 3.3 million possible shots in total.
  • The engine runs on a fixed 1/240 s tick, and the screen draws once every four ticks.
  • Friction is a constant slowdown (grass 260, sand 900, ice 60), and the cup accepts a ball only within 14 u and below 330 u/s.
  • Sine and cosine are home-made polynomials, and the physics has no random numbers.
  • Hashes are compared bit by bit, and the physics files are pinned by hash.
  • A solver uses the same engine to set par, and a hint must survive at least 90% of 105 small shakes.

Written by the JWorld team from our game design documents and measured play data, with AI tools helping with the writing.

More posts

How Stitch Hoop makes its pictures: seven picture checks and boards that always solve

Every Stitch Hoop picture and board is tested before you see it. The seven rules that reject a picture, how needles are built, how a solver proves a board can be won, and the size of Today's picture.

devStitch Hooppuzzle game

What the tavern earns while you are away: how Dokkaebi Tavern pays your time off

How Dokkaebi Tavern turns the time the app was closed into coins. The 4-hour cap, what happens if the clock goes backwards, why helpers matter, and every way to stretch the cap, with the in-game names.

devDokkaebi Tavernidle games

"Hanseong Case Files Guide: Filling the Verdict, the Hint Ladder and the Daily Grid"

How picking up words and filling blanks works, what three tries and the retrial wait mean, how the three hints are priced, what earns the top grade, and how to solve the daily logic grid.

guideHanseong Case Filesdeduction

How Block Daily deals its blocks: 15 drawings, one seed, and a save that replays the dice

A look inside the 8×8 puzzle's core logic: how 37 blocks come from 15 text drawings, how weights stay fair, when a deal is redone, and how saves resume with the same upcoming blocks.

devBlock Dailypuzzle