[source code included]
R&D – Research and Development
I started by organizing the data I had already collected into a spreadsheet and extending it, which resulted on the following table:
Table 1. Data gathering
Next, I went for some sort of validation of these data, and drew the following figure:
Figura 1. Equilateral triangle with 7 unit measures side
Such a prototype, although rudimentary, allowed the verification and validation of the data collected before (as for a 7-side triangle).
The table below defines the composed triangles inside Figure 1.
Tabela 2. Triângulos compostos
Such actions made me see that I was on the right track. Therefore, I went back to the sheet and started to imagine what formula would give an answer to the question proposed by the contest, which can be phrased as follows:
Given an L side equilateral triangle, determine the total number of triangles within it.
It is all about implementing a function that returns 118 when the user provides seven as input, right? Well, I am not so sure… By looking to the data more closely, we can clearly note that only 28 of those are actually real, concrete instances. Isn’t it?
Figure 2. Real, unitary (instantiated) triangles inside a 7-side triangle
All of the others are just optical illusion, or composed by a mix of real (in blue) and “virtual” – nonexistent, illusionary, apparent, or fake – triangles. Right?
Thus, a more accurate and complete answer to the proposed challenge should be represented by something more or less like this:
Listing 1. Stats report
As we can see, there are (at least) two answers to the proposed question. The “right”, more appropriate one will depend on the contextual needs and objectives, which determine purposes and reasons, provide the requirements, and direct our efforts and strategies.
In fact, there is a third valid answer that could be even more recommendable – depending on the client’s specifications. Later I explore this alternative.
Then I went through the process of finding an answer that would contemplate only the use of math; and after some R&D effort, I ended up defining some pertinent concepts (or business rules).
The mathematical formulae that follows represent the functions we need to satisfy the given requirement (as stated previously):
Figure 3. Math formulae that fits to the context.
From these formulae, we can deduce that:
With such information, I was then capable of create the following user interface:
Figure 4. TryAngels Project v.: 0.0.0.1 (R&D) – First User Interface
From one side, this interface both satisfies the specified requirement and address the initial, proposed challenge.
From the other side, however, it is a kind of limited solution; with weak “promotional”, marketing appeal. After all, a triangle is a graphical figure, and to the user should be provided the ability to see the processing results through a graphical representation.
Such solution can also present more details about the triangle, as those presented on the bottom part of Listing 1 (above), provided it satisfy the following non-functional requirements: