15_puzzle_v4

Project Description

This version handles the initiation of the 15 puzzle through cloning and applying the right - premade - costume to each clone.

The positions of all slides are collected into a list called RowList - containing id, row, column, xpos, ypos.

The gap is item 16.

At clicking the neighbours are checked through a double keep items (see nextToGap). If the gap is neighbouring, the swap between the clicked slide and the gap is done. The positions in Rowlist are updated.

The scrambling is done through a list of 16 unique numbers.
To check solvability the number of inversions is counted.
After that the gap-row is established (bottom-row =1)
If both counter and gap-row share the same parity, the puzzle should be solvable. If it turns out not to be solvable, the scrambling is repeated.

Created August 31, 2025

Last updated September 3, 2025

Published August 31, 2025