Compare six ways to place reference designators on dense boards: the four winners of an adversarial benchmark, the springs solver this page started with, and what tscircuit does today. Nothing is placed until you press Solve. Every strategy except tscircuit today, which works in a single pass, can then be stepped through. Every result is judged by the same benchmark scoring, and labels you place by hand stay put.
Solving…
Not solved yet
overlappingmisplaced (reads as another part's, or too far)too closehidden: no acceptable spotplaced by handchanged in this stepcandidate spots of the selected partspring: relaxed → stretchedtrack of the selected partblocked stretch
Nothing is placed until you press Solve. Drag a part to move it. Drag a label to place it by hand (it gets pinned). Double-click a pinned label to release it. Scroll to zoom, drag empty board to pan. With a part selected: R rotates the part, T turns its label 90°, P pins or releases the label, arrow keys nudge (Shift for 1 mm). [ and ] step back and forward.
The four winners beat the springs solver 3 to 4 times on every board set
Penalty points per label from the final sandboxed run (scoring v5, seed 20261006): 8 solvers on 14 boards, 6 seen by the agents, 6 hidden from them and 2 generated for the run. Lower is better. An overlapping label costs 1,000 and a hidden one 600, so hiding every label would score 600; each millimetre off the middle of its side costs a label 2.
Benchmark boards (seen by the agents)Hidden boardsFresh boardsHiding every label: 600
Click a name to select that strategy. The numbers on the right are the benchmark-board averages.
Six strategies, one scoring
The four winners came out of an adversarial benchmark: five solver agents competed over three rounds while a red-team agent tried to break the scoring, and each loophole it found became a rule.
Every result here is judged by that final scoring. An overlapping or touching label costs 1,000 points; a label that reads as another part's, or floats too far away, 300 to 1,000; a hidden label 600; a label closer than the clearance, up to 1,000; a turned label 3; each millimetre from its part, 2, and each millimetre from the middle of the side it sits on, 2. The score is the average per label, so lower is better.
Hiding is an honest outcome: when no acceptable spot exists, a winner hides the label and the designer sees which ones, instead of a label dumped on the wrong part.
The four winners
Conflict graph. Up to several hundred candidate spots per label (125 on average on the MCU board), plus hidden, each priced exactly as the benchmark does. From every label on its cheapest spot, two routes run: greedy descent, annealing and ejection chains, or descent with deeper ejection chains. In an ejection chain, a label takes a better spot and the labels in its way move to their next-best spots; it is kept only if the total drops. The cheaper route wins and is polished with spots tight against neighbouring labels and 0.05 and 0.02 mm nudges.
Clear & re-place. Three starts: the springs solver (3 passes) and two greedy layouts. In rounds, a badly placed label and its six nearest neighbours are lifted and re-inserted together, with a beam search over four insertion orders; the change is kept only when the exact cost drops. Up to six rounds per start, then the cheapest start wins and gets a fine nudge.
Simulated annealing. A greedy start, then 600 moves per label (at least 44,000) as the temperature falls from 300 to 5; a worse move is accepted with probability e−Δ/T. It ends where cooling stops rather than at the best layout it saw, so clean-up stages follow: polish, ejection repair, re-annealing around labels still at 300 points or more, small rebuilds and nudges.
2D springs + final pass. The physics pass is off. Every label starts at its home spot. In up to six passes, labels are priced with an exact copy of the score and, worst first, each takes the candidate spot (every 0.05 mm along each side, both orientations, from clean margins down to tight squeezes, or hidden) that lowers the total most. A label still costing 100 points or more may push up to four labels aside.
All four price every rule of the scoring exactly, including centring: a label sits at the middle of its side unless that costs legibility. Each step you see is a real stage of the algorithm: a pass, a round, a temperature level or an accepted move. Recording the steps changes nothing: the results are bit-identical to the benchmarked solvers. In the benchmark, a solve from scratch took 0.1 to 1 second depending on the board and strategy. An edit re-solved in 20 to 40 ms on average and moved mostly labels near the change.
How the springs solver searches
A label's centre can sit anywhere on a track: the part's courtyard grown by the label–part gap plus half the label's size, so every spot on it just touches the part. A spot is two numbers: s, how far the label slid along the track from its home (the middle of the preferred side), and t, how far it was then pushed straight out.
In that (s, t) map every other part and label blocks a plain rectangle, because all the boxes are axis-aligned. So the cheapest free spot is always at home or on the edge of a blocked rectangle. The solver checks only those columns and takes the lowest free t in each. The search is exact, with no sampling, and it is cheap because the columns are visited cheapest first and the search stops as soon as nothing left can win.
Cost = far-side cost × s ÷ half the track + pull × distance from the middle of the side + ½·k·t² + turn penalty + jump penalty for every part pushed past. The pull keeps a label that cannot sit at home centred on whichever side it takes, instead of drifting to the nearest corner. “4 rays only” runs the same search on just the four columns through the centre of mass, which is the original algorithm.
How the springs solver iterates
First pass. Every label takes the cheapest free spot around its part, upright or turned, clear of other parts, hand-placed labels and the board edge. Labels ignore each other in this pass.
Resolve conflicts. Labels that overlap are ranked by how little it costs them to move. The one with the most slack yields first and moves to the cheapest spot still free.
Relax. Every label slides back toward home and its spring pulls it back toward the part, as far as free space allows.
Push. A label far from home may shove up to two blocking labels aside when that lowers the combined tension.
Steps 2–4 repeat until nothing moves or the iteration limit is reached. Once conflicts are gone, every accepted move lowers the total tension, so the loop always settles. With warm start on, sliding more than about 1 mm or turning after an edit also costs the stickiness value, so labels near an edit stay put unless moving clearly helps.
Placing labels by hand
Dragging a label pins it. Its offset and orientation are stored relative to the part's centre of mass, so it follows the part when you move or rotate it.
Pinned labels are never moved by the solver. Other labels treat them as fixed obstacles. A pinned label may sit on its own part, like a refdes inside an IC outline.
A per-part preferred side overrides the board setting, like a footprint-level default.
What “tscircuit today” shows
The baseline mirrors @tscircuit/core 0.0.2094: the label sits at the footprint's default spot, above the part in the footprint's own frame, so it turns with the part. Only resistors, capacitors and inductors get one fallback: the mirror position through the part's centre, used if it clears other parts. Labels are not checked against each other or the board edge.
Text width is estimated as 0.6 × font size per character, as core does. The JSON export uses tscircuit coordinates (mm, y up, origin at board centre), gives each label's rotation, and its offset as a pcbSx"& silkscreentext" position in the part's frame.