[ BENCHMARKS / v5.0 / TASKS / 123_nbody_f ]

2D N-body Velocity-Verlet integrator in Zig.

A 2D N-body Velocity-Verlet integrator from stdin, to 1e-5 per value.

Unit
123_nbody_f
Category
PhysicsN-body / orbital mechanics
Language
Zig
Difficulty
Hard900 s wall clock (15 min)
Origin
From v4, upgraded
Zig stratum
In samplea retained unit the pack could have been shaped on
Ranked rows passed
7/7single seed each

The prompt

The agent receives exactly this text as its task, verbatim. The harness adds its own system prompt and, in some campaign arms, guidance of its own; the harness chapter describes those. The task’s setup also writes the files its working directory starts with (a worked sample, a repository or a service, where the prompt names them); they are not reproduced here.

Prompt · 123_nbody_f
Create /tmp/eval_nbody/nbody.zig — Read from stdin: line 1 is the number of cases C (1 <= C <= 50). Each case: a line 'N dt steps' (1 <= N <= 8, 0 < dt <= 0.01, 1 <= steps <= 1000), then N lines 'mass x y vx vy' (2D position and velocity). Integrate with Velocity-Verlet and G=1.0: x(t+dt) = x(t) + v(t)*dt + 0.5*a(t)*dt^2; a_i = sum over j != i of G*m_j*(x_j - x_i)/|x_j - x_i|^3 (no softening; bodies stay at least 0.3 apart); v(t+dt) = v(t) + 0.5*(a(t) + a(t+dt))*dt. For each case output N lines, each 'x y vx vy' formatted to 6 decimals (positions and velocities after the final step). Grading runs hidden cases in this format with an absolute tolerance of 1e-5 per value; /tmp/eval_nbody/sample_input.txt and /tmp/eval_nbody/sample_output.txt are a worked sample. Target Zig 0.16.0. Compile with `zig build-exe -O ReleaseFast nbody.zig`.

What it tests and why it is in the suite

What it asks. A 2D N-body Velocity-Verlet integrator from stdin, to 1e-5 per value.

Why it is here. A six-language v4 family, upgraded for v5: seeded hidden tests in the validator, no expected-output files for them and no Zig tutoring. With RKF45 it covers Physics after the stiff-kinetics family (186) did not clear review.

Its stratum. One of three in-sample Zig units: retained units the Zig language pack could have been shaped on. Reading a pack’s effect separately on held-out and in-sample units shows whether it carries knowledge or memorises. Held-out and in-sample

The same problem in 6 languages. Each port is its own unit and asks the same question; SOLVE counts the problem once, and LANG counts how far a solution carried across its ports.

In the suite README: evals/README.md:134 · evals/README.md:156

How it is graded

The validator holds its test cases where the agent cannot read them, and runs them against what the agent left on disk once it stops. Since the upgrade its cases are generated from a seed and no expected output for them is in the agent’s directory (the worked sample the prompt names is only a sample); a mismatch reports only the failing case’s index. The unit was proven like the new ones (reference passes; wrong, empty, leaking and, where timed, slow solutions fail) and passed the same adversarial review.

Upstream: the prover’s controls · one unit’s life cycle · why v5 is built this way

How each ranked run did

One run per board row, the DGX Spark pair first, then the RTX 5090, then the gold standard. Each is a single seed: a pass or a fail on one unit is one draw, and a difference between two rows on one unit says little on its own. Claude Opus 5.5 is the unranked reference, in its own scaffold.

DGX Spark pair

One RTX 5090

Gold standard · unranked

  • Claude Opus 5.5Claude Code tools, no turn cap, 2× wallPassedPassed the validator.