Game 15 in 5 minutes

About

Game 15 (also known as 15 puzzle) is sliding puzzle that have 15 tiles put into 4 by 4 grid leaving one cell empty. Goal of the game is to rearrange the tiles in numerical order.

Link to Wikipedia: https://en.wikipedia.org/wiki/15_puzzle

Live coding

Here is a live coding session that shows how it can be done.

Duration: 4:09

Sources: https://github.com/5minute/examples/tree/main/game15

See live results:https://jsfiddle.net/nofqaLcy/

Disclaimer: never use this code in production. It was created for fun.