Hierarchical information is everywhere: Family trees, organizational charts, taxonomies or product breakdown structures. A good graphical representation can convey a lot of information very quickly. However, creating such a drawing manually is cumbersome. This article will show how such a task can be performed automatically.
The computer computes. Plus, minus, times and sometimes even divide. The results are always correct. Really? Computers usually use floating point numbers, which are very flexible, but still can cause quite substantial rounding errors – at least when you are doing complex calculations with many steps. These small inaccuracies can accumulate and become a creeping poison. Arbitrary precision arithmetic offers a way out.
I recently stumbled upon a game that is not uncommon here in Germany. It is called Scramble Squares (in German “Legespiel”). The specific type of tile-based game, this post will be about, has quadratic cards with pictures on them. These pictures must be arranged to a square in such a way that the pictures on each card fit together with the pictures of the cards around it. I will show how complex this problem is and also present an algorithm to solve it.