push_swap

a sorting puzzle · touch & keyboard

GOAL

Sort stack A in ascending order (smallest on top) using stack B as workspace. All pieces must be in A when done.

OPERATIONS

sa / sb / ssswap top 2 of A / B / both
pa / pbpush top of B→A / A→B
ra / rb / rrrotate A / B / both up
rra / rrbreverse rotate A / B down

MODES

Practice — 5 pieces, no limits. Learn the ops freely.

Play — starts at Level 1 (7 pieces). Beat it to unlock Level 2 (10 pieces). Time & move limits apply.

TIPS

Tap buttons or type ops + enter. Type undo or use the undo button to step back.

A
A
B
B
$>
sa↑↓
pb
ss↕↕
pa
sb↑↓
ra
rra
rr↑↑
rrb
rb
ops: 0