GODRICH
#css-animation#button#loader#transition#scroll#dashboard#ui#design-trends

02Telling Solvable Boards by Counting Flipped Pairs

The tile numbers are laid out in one line and pairs where an earlier number is larger than a later one (inversions) are counted. On a 4x4 board it is solvable only when the inversion count plus the blank's row from the bottom is odd. A board that differs by only two swapped tiles is marked unsolvable, and no number of legal moves afterwards changes the parity of the sum.

Best forChecking a shuffled board before showing it so stuck boards are filtered out

inversionsparityblankRow
Telling Solvable Boards by Counting Flipped Pairs
Open in a new tab

02 Telling Solvable Boards by Counting Flipped Pairs — Measured area 23.449% · moving frames 22/23Original by GODRICH · SCSS and React ship in the zip · Sliding Puzzle: 9 Canvas Scenes, Parity to Search

The post this demo lives in

Sliding Puzzle: 9 Canvas Scenes, Parity to Search - preview of all 9 demosSliding Puzzle: 9 Canvas Scenes, Parity to SearchWhy are some sliding puzzle boards unsolvable? 02 counts flipped pairs to sort them, 05 raises a Manhattan distance boun See all demos in this post

If you like this effect - similar demos