fredkin_sort_network
hardgate countText
results
Measured by total gate count — lower is better.
128 gates53 gates
sota
Usage
Run the reference answer to verify your environment is set up correctly
$ harbor run -p tasks/fredkin_sort_network
Test model
$ harbor run -p tasks/fredkin_sort_network \ -a claude-code -m claude-opus-4-6
Description
Build a reversible circuit that stably sorts four 2-bit unsigned values using as few gates as possible. The available gate set includes NOT, CNOT, Toffoli, and Fredkin gates. All scratch wires must be restored to zero, inputs must be preserved, and the circuit must produce correct output for all 256 possible inputs.
Files
path
permission
/app/circuit.txt✎ Edit/app/main.pyRead-onlyRules
- 01Edit /app/circuit.txt only.
- 02Use only the provided gate set (x, cx, ccx, fred).
- 03Output must be exactly correct for all 256 inputs.
Tags
reversible-computingfredkintoffolisorting-networkgate-countrouting
Model Results
Click a row to view its trajectory in Live Lab
model
reward
score
0.960
Grok-4-20
0.620
0.600
Kimi-K2.6
0.470
Hunyuan-3-Preview
0.360
0.330
0.310
DeepSeek-V4-Pro
0.290
MiMo-V2.5-Pro
0.210
0.000
Qwen-3.6-Plus
0.000