How does the Squad Architect calculate defensive line height, passing triangles, and compactness from on-pitch player coordinates?
The tactical board converts 2D canvas coordinates into simplified geometric telemetry rather than running an empirical match simulation. Defensive line depth tracks the x-coordinate of the deepest outfield player scaled to pitch meters, passing triangles count 3-player cliques whose mutual pairwise distances are each 210 units or less, and spatial compactness measures outfield deviation from their shared centroid.
These telemetry readouts are geometric heuristics designed for chalkboard visualization of the fictional AFC Richmond team from Ted Lasso. They do not model player movement speed, passing trajectory, opposing defensive pressure, or real-world match outcomes.
Clicking the '3-5-2' formation button updates the outfield positions and recalculates the board metrics: the formation indicator changes to 3-5-2, the tactical verdict updates to 'Wide Overload System with Direct Vertical Striker Tandem', and passing triangles adjust according to the newly positioned 3-5-2 coordinate template.
Outfield players exclude the goalkeeper (jersey #1). The engine identifies the minimum horizontal coordinate minDefX among the remaining outfielders and computes rawMeters as Math.round(((minDefX - 50) / 640) * 75 + 32), clamping the value between 30m and 68m.
A passing link is drawn between any two squad tokens whose Euclidean distance is between 40 and 210 units. Passing triangles iterate over every distinct 3-player triplet and increment the counter whenever all three pairwise distances fall under the 210-unit cutoff.
Compactness computes the average Euclidean distance of the 10 outfield tokens from their shared centroid (avgX, avgY). That spread is mapped via Math.round(100 - (avgSpread / 380) * 80) and bounded between 42% and 88%.
The saved fictional tactics board uses a seven hundred forty by five hundred twenty coordinate pitch and eleven stored players. The goalkeeper is identified by shirt number one, and the remaining players enter the defensive line calculation. Their smallest initial horizontal coordinate is one hundred ninety. The code subtracts fifty, divides by six hundred forty, multiplies by seventy five and adds thirty two, then rounds to forty eight. At four pixels per displayed meter, the resulting bar measures one hundred ninety two. The final display is bounded between thirty and sixty eight. These coordinates and meter labels are a designed heuristic, not tracking measurements or proof of real player tactics. Konva is unavailable in the offline verification. Compactness is based on mean Euclidean distance from the outfield centroid. The code subtracts eighty times average spread divided by three hundred eighty from one hundred. A hypothetical average spread of ninety five gives eighty before bounding, while one hundred ninety gives sixty. At three pixels per displayed point, the bars are two hundred forty and one hundred eighty. The label is then clipped between forty two and eighty eight. Reducing this coordinate spread raises the assigned percentage. It does not establish passing success or actual defensive performance. The analytics field can remain a saved label when its rendering dependency fails, so a downloaded number alone is not fresh geometry proof. A passing triangle requires all three pairwise distances to be at most two hundred ten pitch coordinates. Distances two hundred, two hundred five and two hundred ten qualify, but replacing the last with two hundred eleven rejects that same triple. At one pixel per coordinate, the comparison bars measure two hundred ten and two hundred eleven. The algorithm examines all three-player combinations, including the goalkeeper. The JSON team sheet contains formation, phase, lineup and current analytics labels, but not the passing-link array as a separate field. Formation changes preserve player names by array index while replacing roles and positions. This is a fictional planning artifact rather than a verified match forecast.