We are going to end this book with a puzzle and a challenge—both a real and a metaphorical square puzzle. Real, because it is square as you can see from the screenshot a few pages later. Metaphorical, because the code of the puzzle is a squared JavaScript using TDL to the max.
One of the authors thinks this is a good example of what can be achieved in a simple way using TDL. The other author thinks this example is a bridge too far in using component composition. Therefore, we entered this puzzle as a challenge for improvement and as a pun on the title of this chapter.
The example we are going to describe is an implementation of a puzzle you all know from childhood: the 15 square puzzle.
The puzzle has a 4 x 4 square board with 15 tiles on it, that are initially randomly placed and one square is left empty. By sliding a tile that is in a position adjacent to the empty square to the empty square position, you can rearrange the tiles, until the tiles are properly ordered from...