Sorting Network - Algorithm Puzzle

Play Next

View all →

About this game

Sorting Network is a minimal element logic puzzle in the spirit of Opus Magnum and classic algorithm visualizers. N horizontal wires run left to right and you tap one wire then another to place a comparator, a vertical link that sends the smaller value up and the larger value down. The engine packs each comparator into the leftmost column where its wires are free, so comparators that never touch the same wire run in parallel while columns run one after another. Twenty levels span four chapters, from four wires up to eight wire Batcher networks, and later levels add gold locked comparators you cannot remove plus highlighted wire pairs you must use. Every level is backed by a reference network proven by exhaustive testing over all input permutations. Stars reward efficiency, three stars at the known optimum, two stars within optimum plus two, and one star within the level budget. Score equals stars times one hundred plus leftover budget times twenty, and your best score is saved on your device.

How to play

Tap a wire then tap a second wire to place a comparator between them. Smaller values rise and larger values sink. Tap a placed comparator to remove it, and hold the Clear button to wipe everything you added. Press Run to send the test packets through the network column by column. The three visible cases are reverse order, random order and nearly sorted order, and when they pass a hidden exhaustive sweep confirms the network. If a case fails the game marks the column and the wire pair that stayed out of order, and you can keep editing. Locked gold comparators stay fixed, and any highlighted required pair must appear in your network before it can pass.

Tips & Tricks

  • Aim for the known optimum to earn three stars, since extra comparators only lower the score.
  • Comparators that share no wire run in parallel, so a compact network uses fewer columns.
  • Use up to three hints per level to reveal the next wire pair, but a hinted level tops out at two stars.
  • Locked and required pieces are scaffolding, so build the rest of the network around them.

Frequently asked questions

What is a sorting network?

It is a fixed pattern of comparators that sorts any input. Each comparator connects two wires and swaps their values so the smaller one ends up on the upper wire, and the whole pattern guarantees sorted output for every possible input.

How are stars and score decided?

Three stars need the proven minimum comparator count, two stars allow minimum plus two, and one star needs a working network within the level budget. Score is stars times one hundred plus the unused budget times twenty, and your best score is stored on the device.

More Games

Puzzle →