2 Fifteen Puzzle

Fifteen Puzzle

Design and develop a 15-puzzle game, in a dynamic fashion, without using any magic constants, to allow for multiple sizes and right-to-left layout. Interactive demonstrations with different sizes and directions are shown in Figure 1, Figure 2, Figure 3, Figure 4, Figure 5, and Figure 6.

Figure 1: 15-puzzle, left-to-right, size 4.
Figure 2: 15-puzzle, right-to-left, size 4.
Figure 3: 15-puzzle, left-to-right, size 2.
Figure 4: 15-puzzle, left-to-right, size 3.
Figure 5: 15-puzzle, left-to-right, size 5.
Figure 6: 15-puzzle, left-to-right, size 6.