# PoC | TryAngels (R&D)

► [source code included] |
I started by organizing the data I had already collected into a spreadsheet and extending it, which resulted on the following table:
Next, I went for some sort of validation of these data, and drew the following figure:
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.
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?
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:
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.
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):
From these formulae, we can deduce that: - The Termial of L gives the number of real, unitary triangles within an L-side equilateral triangle;
- The number of upward, composed triangles within an L-side equilateral triangle is given by the Tetrahedral of (L – 1);
- The number of downward, composed triangles within an L-side equilateral triangle is given by the Wolfram of L; and finally [our primary goal]
- The Lizard of L. gives the number of “visible”, possible triangles within an L-side equilateral triangle.
With such information, I was then capable of create the following 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: - Memory use optimization
- Performance (processing velocity, fast result feedback)
- Easy use and understanding
The next section describes how I implemented the solution, and References provides a link that allows its download. |