Both of them are playing to win. Neither of them can.
That is a reward function, not a slogan. Every ball a paddle gets back is worth one point — and a ball sent to the far end of the other paddle's side is worth two. Both sides are paid to hurt each other, and the rally gets longer anyway, because the only way to survive your own attack is to be good enough to survive theirs.
The game is the original: two paddles, one ball, a return angle you steer with where you meet the ball, and a ball that speeds up on every return. The ball is never flat — the flattest return it will give you is 22° above the horizontal, and you can send it steeper than that by meeting it with the edge of your paddle. Which is the point: aiming is what attacking is, and a paddle that only ever defends is a paddle that never wins.
3D by three.js · two 65-weight networks trained in the tab · no library for the learning · no server, no account, no keys.
Watch a pair learn to never miss
They start by doing nothing at all. Each network is wired to random noise with its output connected to nothing, so a paddle given a ball just stands there: watch the first serves of its life go past two paddles that are completely still. Then it works out that it can move at all, then which way, then how far. The paddles on this court are not a demonstration player standing in for the real one — they are the two being trained, and the numbers around the court are what they can manage at this moment. Reload the page, or press Start again, and they go back to knowing nothing.
What it is learning, while it learns it
| At this moment | Left | Right |
|---|---|---|
| Points won off the other | 0 | 0 |
| Balls it dropped | 0 | 0 |
| Best score | 0 | 0 |
| …holding unseen balls | — | — |
| Its own step size | 0 | 0 |
What the machines are paid for
A policy that has never returned a ball has to be told something, or there is nothing to search along. So the reward has four parts, and all of them are printed here because a reward you cannot read is a claim you cannot check.
- Returns. Every ball a paddle gets back adds one. A longer rally is worth more than a short one, which is the whole point.
-
Rush — the twist. Each return also pays for what it demanded of the other paddle:
the distance between where that paddle was standing when the ball left, and where the ball is
going to arrive. A ball sent the other paddle's whole length is worth two returns instead
of one. So each side is being paid to beat the other one, and the reward contains its
opponent after all: not as points, but as the ground it was made to give up.
This is the term that changed the game, and the measurement is the reason. An earlier version measured the paddle's OWN travel instead — and a paddle that is tracking well is already near the next arrival point, so a rally of perfectly ordinary balls reported a mean of 151 units out of a possible 580. The pair had learned to survive and had barely learned to attack, which is why the ball sat on its angle floor and read as flat. Measured the other way round, the same pair reports 260–409 out of 580 — and the ball is diagonal, because a paddle that wants that number has to choose to meet the ball off centre. - Mean gap. At every arrival — hit or miss — the reward subtracts five hundredths of the distance between the paddle and the ball. That is the dense signal: a paddle that gets closer is rewarded before it has ever returned anything, and a miss is not a different kind of event, it is the worst case of this one.
-
The point. A serve on which the other paddle missed is worth 50 to the side that
did not. This is the term that says beat the other one, and it is not decoration — it
has real gradient, because a side's own shot decides whether the fixed opponent it is being
judged against can reach the ball. Measured over the same seed and the same budget, it reaches
the zero-loss equilibrium in 134 generations instead of 350, and to a higher rush when
it gets there.
It is deliberately worth less than a miss costs, by four to one. A side that trades its own survival for the opponent's failure does not win the examination, it just ends the rally — and a search paid more for winning than for surviving learns to gamble. - Misses. Each one costs 200. Large enough that the search will trade a shorter rally for safety when it has to.
Which leaves an equilibrium rather than a truce. A weak pair scores badly because it misses. A pair where one side wins scores badly because the rally stops. The only way to score well is to be strong enough to survive a ball aimed at your far corner — and that is why both sides attacking produces the longest rally, not the shortest.
How they learn
By hill climbing, which is the least clever method that works and the easiest one to check.
- One side of the court is copied, every one of its 65 weights nudged, and the copy is kept only if it does better. Then the other side gets a turn.
- Both sides are always judged on the same serves, which is what makes two scores comparable — otherwise the comparison would be measuring luck.
- The serves are redrawn every 25 generations, so a pair cannot pass by learning one particular ball.
- The examination gets longer as they pass it. Holding every serve for 60 returns is generation-one work; 150 is real; 400 across four different serves is 1,600 consecutive returns without a miss, and that is what this page calls zero loss.
The line you cannot cross
A word on the angle, because it is the game. The first version let a paddle put the ball back on the horizontal by meeting it dead centre — and a flat ball at a constant height is returned without moving at all, so doing nothing scored perfectly and the rally never ended. The second version floored the angle at 15°, which was still wrong in a way you can see by playing it: a paddle that meets the ball dead centre returns it AT the floor, every time, so the whole game sat at one shallow angle. The floor is now 22° and the ceiling 40°, so no return ever reads as flat and there is a real band for a paddle to aim within.
And the honest part: the floor does not change the value of the line. The ceiling sets it either way — 1,860 ÷ sin 40° is below 1,860 × 1,064 ÷ (580 × cos 22°) however flat the floor is. What the floor changes is whether the line means anything. With no floor, a flat ball is returned without the paddle moving, the ceiling limit never arises, and two careful players rally for ever at any speed at all. So the floor is not a term in the arithmetic; it is what gives the arithmetic any force. The tempting sentence — "the floor is what makes the line the real constraint" — is false here, which is why it is not on this page.
Questions this page gets asked
What are the machines actually paid for?
One thing: the distance between the paddle and the ball at the moment the ball arrives. A return scores a little; a miss costs a great deal. Nothing in the objective mentions the opponent, so no policy can earn anything by making the other side miss.
Why does a rally ever end if both sides are trying to win?
Because wanting it to continue is not what either side is paid for. The ball gets faster, and it is never flat — the flattest return it will give you is 22° above the horizontal, so every crossing makes the paddle travel and no rally can settle into a horizontal exchange that returns itself. There is a speed above which the ball crosses the court faster than a paddle can run its own length, and past that point a miss stops being a mistake and becomes arithmetic.
Does anything I do here leave my browser?
No. The game, the training and the networks all run in the page, and they are gone when the tab is closed. The site sets no cookie of its own. Google Analytics loads only after you agree to it, and refusing makes no request to Google at all.
Privacy
This policy covers pong-ml.nodejavascript.com and nothing else. It was last changed on 26 September 2026.
- The site sets no cookie of its own, and stores nothing about you. There is no account, no sign-in and no server: the page you are reading was served as a file.
-
Your consent answer is remembered in
localStorageunder the keyanalytics_consent— in your own browser, never sent anywhere. It is kept inlocalStoragerather than a cookie because setting a cookie to record a cookie decision would be its own small joke. -
Google Analytics loads only after you say yes. The tag is not in the page: it is added
by the consent script if, and only if, you agree. If you refuse, no request is made to Google
and no Google cookie is set.
window.gtagdoes not exist until you agree, so the page has no way to send an event before you answer. - What is measured, if you agree: the page you are on, how far down it you scroll, and which buttons and links you press. Nothing you type is read — the paddle keys are never recorded — and nothing about the game you play is sent.
- You can change your answer at any time with the Cookie settings button in the footer below.
-
If something breaks, the page reports it to this site's own address. A script of
ours sends the fault to
/api/faulton this origin, which passes it on — so the message, the file and line it came from, this page's path (never the query string), and the browser's own name for itself. No cookie, no identifier, and nothing you type or play; nothing is sent at all if your browser asks not to be tracked. - What you play stays here. The networks are trained in your tab. Nothing you play is uploaded — the only thing this page ever sends is the fault note above, and an analytics event if you agreed to one.